Re: [WebDNA] unix timestamp in WebDNA

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 102083
interpreted = N
texte = Take a look here at a post from John Peacock: http://dev.webdna.us/TalkListArchive/DetailResults.tpl?command=search&db=webdna-talk.db&eqIDdata=56525&max=1&words=Seconds%20since%20epoch Dana Keil wrote: > 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? > > > > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > . > -- ------------------------------------------- Marc Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- 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)
Take a look here at a post from John Peacock: http://dev.webdna.us/TalkListArchive/DetailResults.tpl?command=search&db=webdna-talk.db&eqIDdata=56525&max=1&words=Seconds%20since%20epoch Dana Keil wrote: > 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? > > > > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > . > -- ------------------------------------------- Marc Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- Marc Thompson

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:

ShipCosts database (1997) TeaRoom Order fields email account remain empty even though thewy are filled. (1997) Major Security Hole (1998) Add a field to the error log? (1997) WebCat2 - [format thousands] (1997) WebCatalog Q & A pages (1997) problems with 2 tags shakur (1997) user authentication via TCPSend (2005) Limit on nested [ShowIf]'s? (1997) SHOWIF/HIDEIF empty fields (2005) searches with dash, period etc. (2000) emailer settings and control questions (1997) [WebDNA] [OT] Apple iPad (2010) Payment Calculator (2000) WebCatalog template cache (1998) Off-Topic: List of common port numbers? (2002) Fun with dates (1997) [isfile] ? (1997) Beta 18 (1997) Help! WebCat2 bug (1997)