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. -- Dana On Feb 27, 2009, at 3:05 PM, Donovan Brooke wrote: > What platform?..linux? Mac? Windows? Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] unix timestamp in WebDNA (Donovan Brooke 2009)
  2. Re: [WebDNA] unix timestamp in WebDNA (Dana Keil 2009)
  3. Re: [WebDNA] unix timestamp in WebDNA (Dana Keil 2009)
  4. Re: [WebDNA] unix timestamp in WebDNA (Marc Thompson 2009)
  5. Re: [WebDNA] unix timestamp in WebDNA (Marc Thompson 2009)
  6. Re: [WebDNA] unix timestamp in WebDNA (Dana Keil 2009)
  7. Re: [WebDNA] unix timestamp in WebDNA (Marc Thompson 2009)
  8. Re: [WebDNA] unix timestamp in WebDNA (Donovan Brooke 2009)
  9. Re: [WebDNA] unix timestamp in WebDNA (Dana Keil 2009)
  10. Re: [WebDNA] unix timestamp in WebDNA (Donovan Brooke 2009)
  11. Re: [WebDNA] unix timestamp in WebDNA (Donovan Brooke 2009)
  12. RE: [WebDNA] unix timestamp in WebDNA ("Olin Lagon" 2009)
  13. Re: [WebDNA] unix timestamp in WebDNA (Donovan Brooke 2009)
  14. Re: [WebDNA] unix timestamp in WebDNA (Marc Thompson 2009)
  15. [WebDNA] unix timestamp in WebDNA (Dana Keil 2009)
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. -- Dana On 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:

taxTotal, grandTotal (1997) Format question WC Mac f3 (1997) Include a big block of text (1997) Q: for those who use Cookies for sessions? (2004) variables in [addlineitem] (1998) Surprise x and y post args (1998) [WebDNA] Updating Master Store Question (2009) OR-searching (2000) problems with WebCat-Plugin (1997) WebCat2b13MacPlugin - nested [xxx] contexts (1997) FYI: virus alert (1996) [WebDNA] My SQL will not Connect (2020) Locking up with WebCatalog... (1997) oops private message leaked into talk list (1997) OT pipe - was can webcat determine an image's pixel dimensions? (2000) [accountNum] and [math] (1997) 5.1: Can't enter serial number (2004) error: Too many nested [xxx] contexts (1997) OFF TOPIC: help wanted (1997) This list needs a digest: rant, rave... (1997)