I searched to see if this had been brought up before, can't seem
to find it. It would be great to have Unix-like time functions
available in PBCC. I'm sure I could spend lots of time writing the
functions myself, but do they already exist? Built-in to v5 would be great.
Unix has a timestamp: a 32-bit or 64-bit timer that counts the
seconds since January 1, 1970. Dealing with our oddball crazy calendar
then becomes much easier; ie, doesn't matter if a month has 30 days or
31 days, leap years don't matter, etc. It can make life easy; ie, given
the current timestamp, add 604800 to find the timestamp a week from now
(604800 is 60 * 60 * 24 * 7). It won't matter if it falls in a different
month, different year, or even different century.
Unix languages then have some great tools to convert the timestamp back
to useful strings. You can code, for exmaple,
which produces something like: Monday 15th of August 2005 03:12:46 PM
This came up because I'm writing code that needs to produce the calendar
date of the date five days from now. Starting from scratch is a pain because
suddenly you're dealing with irregular month length, leap years, etc.
Somebody already have those routines written? Would love to see built-in....
------------------
Christopher Becker
Advanced Airborne Test Facility
Island of Kauai, Hawaii
[This message has been edited by Christopher Becker (edited April 03, 2006).]
to find it. It would be great to have Unix-like time functions
available in PBCC. I'm sure I could spend lots of time writing the
functions myself, but do they already exist? Built-in to v5 would be great.
Unix has a timestamp: a 32-bit or 64-bit timer that counts the
seconds since January 1, 1970. Dealing with our oddball crazy calendar
then becomes much easier; ie, doesn't matter if a month has 30 days or
31 days, leap years don't matter, etc. It can make life easy; ie, given
the current timestamp, add 604800 to find the timestamp a week from now
(604800 is 60 * 60 * 24 * 7). It won't matter if it falls in a different
month, different year, or even different century.
Unix languages then have some great tools to convert the timestamp back
to useful strings. You can code, for exmaple,
Code:
PRINT UnixDate("l dS \of F Y h:i:s A",timestamp???)
This came up because I'm writing code that needs to produce the calendar
date of the date five days from now. Starting from scratch is a pain because
suddenly you're dealing with irregular month length, leap years, etc.
Somebody already have those routines written? Would love to see built-in....
------------------
Christopher Becker
Advanced Airborne Test Facility
Island of Kauai, Hawaii
[This message has been edited by Christopher Becker (edited April 03, 2006).]
Comment