calculate day of the year

TomasTomas Member Posts: 420
You have a posting date, for example 01/01/2007. You must return day of the year, formated like XXX (instead of spaces use zeros). How would you do that?

My solution (however, i think there should be better ways of doing it):
DayOfYear := CONVERTSTR(FORMAT(("Posting Date"-DMY2DATE(01,01,DATE2DMY("Posting Date",3)))+1,3),' ',0);

Comments

Sign In or Register to comment.