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%20epochDana 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 ThompsonSoftware EngineerOffice of Information TechnologyUniversity of Utah801.585.9264marc.thompson@utah.edu-------------------------------------------
Associated Messages, from the most recent to the oldest:
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%20epochDana 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 ThompsonSoftware EngineerOffice of Information TechnologyUniversity of Utah801.585.9264marc.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:
Listserver problem (1997)
WebCat2 Append problem (B14Macacgi) (1997)
Need Sample Template - just purchased (1997)
shipcost (1997)
really wierd browser truncating (1997)
PCS Frames (1997)
How flexible is Shipping? (1997)
Multiple Pulldowns (1997)
Weird [blank] interpretation (1999)
searchable list archive (1997)
Sub Totals (2000)
Math Problem - Format? (1997)
Path of Events (1999)
billing system (2003)
sending two mails from one template (2004)
Stopping bad HTML propagation ? (1997)
PCS Frames (1997)
WebCat2 - many [carts] on one template page? (1997)
Pithy questions on webcommerce & siteedit (1997)
X etc.... (1999)