01-21-2014, 01:24 PM
This formula calculates the day number of any date (given month and day). A 365 day year is used. If you are operating with a leap year with dates after February 28, add 1.
Hence in non-leap years, January 1 is Day 1, February 1 is Day 32, etc..., December 1 is 335, and December 31 is 365.
Details are at my blog: http://edspi31415.blogspot.com/2014/01/h...-year.html
Formula:
Day Number, 365 Day Year, M≤2:
D + IP(30.6M + 1.6 + 367.2) - (34 + 365) = D + IP(30.6M + 368.8) - 399
M>2:
D + IP(30.6M + 1.6) - 34
HP Prime Program DAYNO:
EXPORT DAYNO(M,D)
BEGIN
IF M≤2 THEN
RETURN IP(30.6*M+368.8)+D-399;
ELSE
RETURN IP(30.6*M+1.6)+D-34;
END;
END;
Hence in non-leap years, January 1 is Day 1, February 1 is Day 32, etc..., December 1 is 335, and December 31 is 365.
Details are at my blog: http://edspi31415.blogspot.com/2014/01/h...-year.html
Formula:
Day Number, 365 Day Year, M≤2:
D + IP(30.6M + 1.6 + 367.2) - (34 + 365) = D + IP(30.6M + 368.8) - 399
M>2:
D + IP(30.6M + 1.6) - 34
HP Prime Program DAYNO:
EXPORT DAYNO(M,D)
BEGIN
IF M≤2 THEN
RETURN IP(30.6*M+368.8)+D-399;
ELSE
RETURN IP(30.6*M+1.6)+D-34;
END;
END;