Re: [WebDNA] unix timestamp in WebDNA
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 102081
interpreted = N
texte = I'm on MacOS X, does WebDNA use different starting times for its timestamp depending on platform? Maybe I'm thinking of the difference between MacOS 9 and MacOS X.Anyway, I've come up with the solution to my own question.CAUTION: do not use this code to do actuarial work, navigate spacecraft or manage nuclear reactors ;-), it may not do the right thing with leap seconds, etc.To convert WebDNA date and time to a unix timestamp, where the standard WebDNA formats are used (date is MM/DD/YYY and time is HH:MM:SS) use:unixtimestamp=[math](({[date]}-{01/01/1970})*86400)+({[time]}+28800)[/ math]In place of the WebDNA tags [date] and [time] used above which gives the current unix timestamp, a database lookup or a static date and time can be used to give the unix timestamp for any given date and time.Since the unix epoch starts on Jan 1, 1970, that is subtracted from the WebDNA timestamp (which is the number of days since 1/1/0000). Since the unix timestamp is expressed in seconds, multiply by 86400 and then add the WebDNA time (which provides the number of seconds since midnight). I add the 28800 seconds to make it Universal Time that the unix timestamp uses instead of my Pacific Standard Time, change the number if in a different time zone.--DanaOn Feb 27, 2009, at 3:05 PM, Donovan Brooke wrote:> What platform?..linux? Mac? Windows?
Associated Messages, from the most recent to the oldest:
I'm on MacOS X, does WebDNA use different starting times for its timestamp depending on platform? Maybe I'm thinking of the difference between MacOS 9 and MacOS X.Anyway, I've come up with the solution to my own question.CAUTION: do not use this code to do actuarial work, navigate spacecraft or manage nuclear reactors ;-), it may not do the right thing with leap seconds, etc.To convert WebDNA date and time to a unix timestamp, where the standard WebDNA formats are used (date is MM/DD/YYY and time is HH:MM:SS) use:unixtimestamp=
[math](({
[date]}-{01/01/1970})*86400)+({
[time]}+28800)[/ math]In place of the WebDNA tags
[date] and
[time] used above which gives the current unix timestamp, a database lookup or a static date and time can be used to give the unix timestamp for any given date and time.Since the unix epoch starts on Jan 1, 1970, that is subtracted from the WebDNA timestamp (which is the number of days since 1/1/0000). Since the unix timestamp is expressed in seconds, multiply by 86400 and then add the WebDNA time (which provides the number of seconds since midnight). I add the 28800 seconds to make it Universal Time that the unix timestamp uses instead of my Pacific Standard Time, change the number if in a different time zone.--DanaOn Feb 27, 2009, at 3:05 PM, Donovan Brooke wrote:> What platform?..linux? Mac? Windows?
Dana Keil
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
RE: Going to anchors within a template page (1997)
Fun with Dates - revisited (1997)
[WebDNA] LowRam (2012)
Typhoon Rev. and PCS store problems (1999)
Access to shopping cart files (2005)
Configuring E-mail (1997)
creating a 60 fields database (1997)
Off Topic - OS X web server, FTP accounts (2003)
PCS Customer submissions ? (1997)
Formulas.db + Users.db (1997)
Are they really global tags? (2002)
Navigator 4.01 (1997)
Re[2]: Field Problem (2000)
Not Authorised Adding Items (1998)
[OT] Command Line Change Name (2004)
SiteEditPro (1996)
form data submission gets truncated (1997)
f2 download problems (1997)
[WebDNA] Searching Possible Bug (2009)
Request for page test (2003)