Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Birthdate Sort


DocD
 Share

Recommended Posts

Hi All,

 

OK, I have a field called 'User_DateOfBirth'. Obviously it is simply a date field with month/day/year. What I want to do is simply sort the field without using the year so I might be able to judge whose birthday is approaching...so, I need to have the year extracted in a script...

 

Thanks!

 

DocD

Link to comment
Share on other sites

You need a calculation field, not a script. The actual calculation can be done in several ways, for example:

 

Date ( Month ( User_DateOfBirth ) ; Day ( User_DateOfBirth ) ; 4 )

result is Date

 

or:

Month ( User_DateOfBirth ) + Day ( User_DateOfBirth ) / 100

result is Number

 

or even:

DayOfYear ( User_DateOfBirth )

result is Number

 

Then sort by the calculation field instead of User_DateOfBirth.

 

 

Note:

- Using the first option, you can format the result to show just the month and day, so it displays like "Birthday: July 28" on the layout;

 

- Using the last option, people born in a leap year on March 1 or later, will be placed after people born on the same date in a non-leap year.

Link to comment
Share on other sites

Try sorting by a calc that has the month and day only, like this:

 

right("00" & Month(User_DateOfBirth);2) & right("00" & day(User_DateOfBirth);2)

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use