Page 1 of 1

[Solved]jdate doesn't work with custom regional settings????

Posted: 27 Mar 2009 15:16
by avery_larry
I'm not going to pretend to completely understand julian . . .

The code doesn't seem to differentiate between 4 digit year and 2 digit year format. On my machine with a 4 digit year, :jdate %date% returns 2454918 where %date% is "Fri 03/27/2009". On my custom computer with a 2 digit year, :jdate %date% returns 1724433 where %date% is "03/27/09".

Perhaps this is accounted for by the specs -- which state a 4 digit year -- but then it proceeds to use the system variable %date% if nothing else is given (plus it claims to match regional settings--which it does other than the 2 digit/4 digit date (I think)).

I guess it would be too complicated perhaps to try and code an intelligent guess. Something like "if I must use %date%, then set yy=2000 + yy %% 2000 before calculating the julian date"?

Or if (and ONLY if) %date% is used, then assume the current date is at least 2000 -- then it would be:

Code: Select all

set /a "yy=10000%yy% %% 10000 %% 2000 + 2000,mm=100%mm% %% 100,dd=100%dd% %% 100"


Maybe I'm thinking too much. ?

Posted: 28 Mar 2009 23:23
by DosItHelp
avery_larry,

Good thinking!
The functions :jdate and :date2jdate have been corrected to support 2 digit years by adding 2000.
Give it a try and let me know of the :jdate function now works for you.
http://www.dostips.com/DtCodeCmdLib.php#jdate

Thanks,
DosItHelp

Posted: 30 Mar 2009 08:15
by avery_larry
Indeed -- that works just great.