I want to create zodiac sign out of users birthday

Hi there, @theswati15… if I was doing what you described, I would likely start by creating an option set that has the zodiac signs as the options. The option set would also have two attributes (number) that would be used to define the range for each sign.

As far as calculating the day of the year from a birthday goes, there might be multiple ways to go about it, but this works.

day

In words, the expression gets the last day of the current year and subtracts the user’s birthday from it (with the user’s birth year changed to the current year) and then subtracts 365 from that number and multiplies by -1. I’m sure you could do 365 minus the expression to avoid having to multiply by -1, but you get the point. Oh, and if your next question is how did I get the parentheses in there, make sure to enable the experimental parentheses feature.

Then, once you have the user’s birthday converted to the day of the year, get the option from the option set where the resulting day is greater than or equal to the lower number in the option’s range and less than or equal to the higher number in the option’s range, and you’re good to go.

Hope this helps.

Best…
Mike

P.S. 20 Feb is the 51st day of the year, not the 41st… you really threw me off there and had me thinking my expression wasn’t working when I tried it with that date.

1 Like