### Day of Year example

Posted:

**Tue Jan 10, 2017 5:16 pm**I found some day of year information, but had trouble adapting it to exactly what I wanted. So here is an example that would have helped me.

Information. It is simple to subtract the first day of the year from another date and get a number, but if that is changed to an integer, it rounds up or down to the nearest integer so it was trickier than I expected.

Floor(((DateMod365.25)+1))

Floor - truncates the number to an integer without changing it.

Date - this is the field that it is calculating

Mod - this function gives you the remainder of the date divided by 365.25 (not an integer to account for leap years).

1 has to be added, or Jan 1 = 0 and the last day is 364, not 365.

Information. It is simple to subtract the first day of the year from another date and get a number, but if that is changed to an integer, it rounds up or down to the nearest integer so it was trickier than I expected.

Floor(((DateMod365.25)+1))

Floor - truncates the number to an integer without changing it.

Date - this is the field that it is calculating

Mod - this function gives you the remainder of the date divided by 365.25 (not an integer to account for leap years).

1 has to be added, or Jan 1 = 0 and the last day is 364, not 365.