I am trying to capture today’s Julian date and add it to an input box, but the date is incorrect. Can you tell me what I am doing wrong? Here is my code.
IF(IsNullOrEmpty(Attributes.Product_description.Opportunity_ID_8349.Note_1), AskString$(“Type in a Lot Number”,False,“Lot Number -” + str$(DateToJulian(Today()),5,0)),
AskString$(Attributes.Product_description.Opportunity_ID_8349.Note_1 +“-”+ str$(DateToJulian(Today()),5,0))).
The Julian date I am getting is 2460605, and the correct date is 24296
Where do you get your correct value of 24296 from? The Julian date is a bit tricky as there are different definitions for the start date. We use January 1st 4713 BC as offset. The Julian date according to this definition then is the number of days since this date. As these are roughly 6740 years, you can expect something in the range of 2.4 million days which is what List & Label returns.
The difference here is most probably due to the changeover from Julian to Gregorian calendar, which is handled slightly different based on the date library used. Usually, it’s just important that the back-and-forth calculations are using the same calculation scheme. If you want to mimic a specific calculation of Julian dates, you can always add an offset to the number returned.