I would like to order the DOB field in my form, based on month and day. How can I do this?

I would like to order the DOB field in my form, based on month and day. How can I do this?

To sort records based on custom value acquired from the DOB field i.e., month and day, you may add a formula field with below suggested sample expression,


((((((DOB.getMonth() / 100).round(2))) + "").getSuffix(".")) + "-") + ((((DOB.getDay() / 100).round(2))) + "").getSuffix(".")
where,
- DOB.getMonth, returns a number in the range (1 -12), representing the number of the month of the year, on which the date occurs.
- DOB.getDay(), returns a number in the range (1 - 31), representing the number of the day of the month on which the date occurs.


The formula expression specified above, returns: [mm]-[dd]. It makes both the month and date, a two digit number. Otherwise ordering goes wrong like: 1, 10, 11, 12, 2, 3, etc.