Hi, I have a VB Script that converts the current date into an ordinal date code, i.e. 001-365 for the day of the year, and a 2-digit number for the last 2 digits of the current year. Only problem is that the number is one digit off of what it should be. That is, if Feb. 1, 2012 should be 03212 (the 32nd day of 2012), the output is actually 03312. Here is what the script looks like that creates.
Public Function CDate2Julian(MyDate As Date) As String
CDate2Julian = Format(MyDate - DateSerial(Year(MyDate) - 1, 12, _
31), "000") & Year(MyDate) Mod 100
End Function
I've found that if I change the 31 at the end of that string to 32, it's good for the first 4 months, then I have to change back some time between April 30 and May 15(ish) to get the rest of the year to calculate right. Not sure if it's a Leap Year thing or not....