Re: [WebDNA] Need to convert unix date?

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 104192
interpreted = N
texte =
Yeah, thanks a million for adding to our ready-to-go WebDNA code!=A0

Terry

On Th= u, 17 Dec 2009 10:13:48 +1100
Stuart Tremain <webdna@idfk.com.au> wrote:
> Very nice job Brian
> > It gives me an idea for some other stuff ....
>
>
> Regards
>
> Stuart Tremain> IDFK Web Developments
> AUSTRALIA
> webdna@idfk.com.au
>
>
>
> <= br>> On 17/12/2009, at 9:53 AM, Brian Fries wrote:
>
>> As my holiday gift to the list, see the attac= hed WebDNA
>>function library, "brainepoch.lib".
>>
>> This library contains WebDNA f= unctions for working with
>>timestamps (seconds since WebDNA zero date or 1/1/0000)
&= gt;>and Unix Epoch (seconds since Unix zero date of
>>1/1/1970).
>>
>> The functions inc= lude:
>>
>> bepVersion-Returns version code for this library
>>release=
>> bepFunctions-Returns list of function names
>>supported by this library release
>> = bepGMTOffset-Return Hours from GMT to local time
>> bepSetGMTOffset-Set value of GMT Offset
>> = bepEpochDays-Days from WebDNA epoch (1/1/0000) to
>>Unix epoch (1/1/1970)
>> bepTimestamp= -Seconds since WebDNA epoch (1/1/0000)
>> bepTimestampDate-Return Date component of a >>bepTimestamp value
>> bepTimestampTime-Return Time component of a
>>bepTimestamp v= alue
>> bepTimestampDayRange-Return search rn value for a day
>>or range of days
>> bepEp= och-Seconds since Unix epoch (1/1/1970)
>> bepEpochDate-Return Date component of a bepEpo= ch
>>value
>> bepEpochTime-Return Time component of a bepEpoch
>>value>> bepEpochDayRange-Return search rn value for a day or
>>range of days
>> bepCartEpoch-= Generate Epoch from Cart value
>> bepCartGMTOffset-Generate GMT Offset from current
>>cart val= ue
>> bepCartDate-Return Date, extracted from Cart ID
>> bepCartTime-Return Time, extracte= d from Cart ID
>>
>>
>> The source code is fairly thoroughly documented, so you
= >>can read the comments above each function to learn how to
>>use them appropriately.
>> =
>> One part that's not obvious is that you should first
>>(one time only) call the "bepSetGMTOffs= et" function to
>>save your system's GMT offset preference for future use.
>>
>> Happy holi= days!
>>
>> Brian Fries
>> BrainScan Software
>>
>> P.S. Good f= olks at WebDNA corp: Feel free to post this
>>to your downloads section.
>>
>> On Dec 16= , 2009, at 2:13 PM, David Bastedo wrote:
>>
>>> what does: Math to use Date Display F= ormat? do in the
>>>config? it is set to no?
>>>
>>> On Wed, Dec 16, 2009 at 5:08 = PM, Bob Minor
>>><bob@cybermill.com> wrote:
>>> Works on my servers, must be a config issue!
&g= t;>>
>>> On Dec 16, 2009, at 3:58 PM, Dan Strong wrote:
>>>
>>> > What is = your date format set to in your WebDNA admin?
>>>Mine is "Month/Date/Year (American)"?
>>> >= ;
>>> > -Dan Strong
>>> > http://www.DanStrong.com
>>> >=
>>> > On 12/16/2009 1:55 PM, David Bastedo wrote:
>>> >> So when I put that code on = my server, I get 3909 as
>>>the year. I have
>>> >> tried it on two different servers, = so I am not sure
>>>what is up.
>>> >>
>>> >> -----
>>&g= t; >> [math]val=3D1252257406*1[/math] =3D [math
>>>date]{01/01/1970} + {[format
>>> >&g= t; days_to_date %m/%d/%Y][format
>>> >>
>>>.6d][math]([val]/86400)[/math][/format][/format]= }[/math]
>>> >> 1252257406=3D09/06/3909
>>> >>
>>> >>= I have deconstructed the original time stamp to:
>>> >>
>>> >>
>>> >= ;> [Math
>>> >>
>>>show=3Df]subTotal=3D[Math]{09/14/2009}[/math]-[Math]{01/0= 1/1970}[/math][/math]
>>> >> total time + days + 1 day - 5 hours
>>> >>
>>= >=3D[math]([subTotal]*86400)+{06:08:54}+86400-18000[/math]=3D
>&= gt;> >> [reaction_published]
>>> >>
>>> &g= t;> so technically, if I do this in the reverse, I should
>>>get what I need . . .
>>> &= gt;>
>>> >> d.
>>> >>
>>> >>
>>> >= >
>>> >>
>>> >>
>>> >>
>>> >> On Wed, Dec 16= , 2009 at 4:01 PM, Marc Thompson
>>><mthompson@media.utah.edu
>>> >> <= ;mailto:mthompson@media.utah.edu>> wrote:
>>> >>
>>> >> Not sure what= the "+1" is for from Dan's example
>>>besides adding an extra
>>> >> day? = However, I put the code on my server so you
>>>could see it working.
>>> >> http://= webapps.utah.edu/test/temp.tpl
>>> >>
>>> >> Seems to work fine on my server, whi= ch is -7DST.
>>> >>
>>> >> You would need to add some more form= atting code to
>>>get it in the form
>>> >> you show in your previous post.
>&= gt;> >> ie. The timestamp 1252976934 corresponds to
>>>2009/09/14 06:08:54 pm PDT.
= >>> >>
>>> >>=20 Marc
>>> >>
>>> >> David Bastedo= wrote:
>>> >> > Unfortunately, I get: 09/16/3909 with the code
>>>below:>>> >> >
>>> >> > I'm trying to work through this . . .
>>> &= gt;> >
>>> >> =20 > d.
>>> >> >
>>> >> &g= t;
>>> >> > On Wed, Dec 16, 2009 at 11:17 AM, Marc Thompson
>>> >> >= <mthompson@media.utah.edu
>>><mailto:mthompson@media.utah.edu>
>>> &= gt;> <mailto:mthompson@media.utah.edu
>>><mailto:mthompson@media.utah.edu>>>
>&g= t;> >> wrote:
>>> >> >
>>> >> > Here you go:
&= gt;>> >> >
>>> >> > [math]val=3D1252976934*1[/math] =3D [math
>&= gt;>date]{01/01/1970} +
>>> >> {[format
>>> >> > days_to_date %m/%d/%Y][= format
>>> >> >
>>> .6d][math]([val]/86400)+1[/math][/format][/format]}[/= math]
>>> >> =20 >
>>> >> > Marc
>>> >> = >
>>> >> > =20 David Bastedo wrote:
>>> >> > > The timestamp= *1252976934* corresponds to*
>>>2009/09/14 06:08:54 pm
>>> >> > = PDT*.
>>> >> > >
>>> >> > > this is the time stamp: *1252= 976934*
>>> >> > >
>>> >> > > [format days_to_date %m/%d/%Y= ][format
>>> >> > >
>>>.6d][math]([your_UNIX_timestamp]/86400)+1[/math][/format]= [/format]
>>> >> > >
>>> >> > > gets me: 09/16/39
>>= > >> > >
>>> >> > > d.
>>> >> > >
>&= gt;> >> > > On Tue, Dec 15, 2009 at 6:54 PM, Dan Strong
>>> >> <webdna@danstr= ong.com
>>><mailto:webdna@danstrong.com>
>>&g= t; >> > <mailto:webdna@danstrong.com
>>><mai= lto:webdna@danstrong.com>>
>>> >> > > <mailto:webdna@danstrong.com
>>>&l= t;mailto:webdna@danstrong.com>
>>> >> <mailto:webdna@danstrong.com
>>><mailto:we= bdna@danstrong.com>>>> wrote:
>>> >> > >
>>> >> = > > Try this:
>>> >> > >
>>> >> > > [format= days_to_date %m/%d/%Y][format
>>> >> > >
>>> >>
>>> .6d][m= ath]([your_UNIX_timestamp]/86400)+1[/math][/format][/format]
>>&= gt; >> > >
>>> >> > >
>>= > >> > >
>>> >> > > On 12/15/2009 3:47 PM, David Bastedo
>&= gt;>wrote:
>>> >> > >
>>> >> > > Hi, I need to convert= a date stored
>>>in unix format -
>>> >> seconds
>>> >> > &= gt; since Jan
>>> >>=20 > > 01, 1970. Is there a formula or
>>>func= tion that anybody
>>> >> =20 > might have?
>>> >> > >
>>&g= t; >> > > I am pulling in an xml file generated
>>>by an external
>>> &= gt;> api and
>>> >> =20 > > that date
>>> >> > > = comes in this format.
>>> >> > >
>>> >> > > tha= nks.
>>> >> > >
>>> >> > > d.
>>> &g= t;> > >
>>> >> =20 > >
>>> >> > > --
>>= > >> > > David Bastedo
>>>
>> <brainepoch.zip>
>
<= br>=A0
Associated Messages, from the most recent to the oldest:

    
  1. Fwd: [WebDNA] Need to convert unix date? (William DeVaul 2011)
  2. Re: [WebDNA] Need to convert unix date? (Donovan Brooke 2009)
  3. Re: [WebDNA] Need to convert unix date? (Donovan Brooke 2009)
  4. Re: [WebDNA] Need to convert unix date? (Marc Thompson 2009)
  5. Re: [WebDNA] Need to convert unix date? (christophe.billiottet@webdna.us 2009)
  6. Re: [WebDNA] Need to convert unix date? (Govinda 2009)
  7. Re: [WebDNA] Need to convert unix date? (Dan Strong 2009)
  8. Re: [WebDNA] Need to convert unix date? ("Terry Wilson" 2009)
  9. Re: [WebDNA] Need to convert unix date? (Dan Strong 2009)
  10. Re: [WebDNA] Need to convert unix date? (Stuart Tremain 2009)
  11. Re: [WebDNA] Need to convert unix date? (Brian Fries 2009)
  12. Re: [WebDNA] Need to convert unix date? (David Bastedo 2009)
  13. Re: [WebDNA] Need to convert unix date? (David Bastedo 2009)
  14. Re: [WebDNA] Need to convert unix date? (Bob Minor 2009)
  15. Re: [WebDNA] Need to convert unix date? (Dan Strong 2009)
  16. Re: [WebDNA] Need to convert unix date? (David Bastedo 2009)
  17. Re: [WebDNA] Need to convert unix date? (Marc Thompson 2009)
  18. Re: [WebDNA] Need to convert unix date? (David Bastedo 2009)
  19. Re: [WebDNA] Need to convert unix date? (David Bastedo 2009)
  20. Re: [WebDNA] Need to convert unix date? (Marc Thompson 2009)
  21. Re: [WebDNA] Need to convert unix date? (Dan Strong 2009)
  22. Re: [WebDNA] Need to convert unix date? (David Bastedo 2009)
  23. Re: [WebDNA] Need to convert unix date? (Dan Strong 2009)
  24. [WebDNA] Need to convert unix date? (David Bastedo 2009)
Yeah, thanks a million for adding to our ready-to-go WebDNA code!=A0

Terry

On Th= u, 17 Dec 2009 10:13:48 +1100
Stuart Tremain <webdna@idfk.com.au> wrote:
> Very nice job Brian
> > It gives me an idea for some other stuff ....
>
>
> Regards
>
> Stuart Tremain> IDFK Web Developments
> AUSTRALIA
> webdna@idfk.com.au
>
>
>
> <= br>> On 17/12/2009, at 9:53 AM, Brian Fries wrote:
>
>> As my holiday gift to the list, see the attac= hed WebDNA
>>function library, "brainepoch.lib".
>>
>> This library contains WebDNA f= unctions for working with
>>timestamps (seconds since WebDNA zero date or 1/1/0000)
&= gt;>and Unix Epoch (seconds since Unix zero date of
>>1/1/1970).
>>
>> The functions inc= lude:
>>
>> bepVersion-Returns version code for this library
>>release=
>> bepFunctions-Returns list of function names
>>supported by this library release
>> = bepGMTOffset-Return Hours from GMT to local time
>> bepSetGMTOffset-Set value of GMT Offset
>> = bepEpochDays-Days from WebDNA epoch (1/1/0000) to
>>Unix epoch (1/1/1970)
>> bepTimestamp= -Seconds since WebDNA epoch (1/1/0000)
>> bepTimestampDate-Return Date component of a >>bepTimestamp value
>> bepTimestampTime-Return Time component of a
>>bepTimestamp v= alue
>> bepTimestampDayRange-Return search rn value for a day
>>or range of days
>> bepEp= och-Seconds since Unix epoch (1/1/1970)
>> bepEpochDate-Return Date component of a bepEpo= ch
>>value
>> bepEpochTime-Return Time component of a bepEpoch
>>value>> bepEpochDayRange-Return search rn value for a day or
>>range of days
>> bepCartEpoch-= Generate Epoch from Cart value
>> bepCartGMTOffset-Generate GMT Offset from current
>>cart val= ue
>> bepCartDate-Return Date, extracted from Cart ID
>> bepCartTime-Return Time, extracte= d from Cart ID
>>
>>
>> The source code is fairly thoroughly documented, so you
= >>can read the comments above each function to learn how to
>>use them appropriately.
>> =
>> One part that's not obvious is that you should first
>>(one time only) call the "bepSetGMTOffs= et" function to
>>save your system's GMT offset preference for future use.
>>
>> Happy holi= days!
>>
>> Brian Fries
>> BrainScan Software
>>
>> P.S. Good f= olks at WebDNA corp: Feel free to post this
>>to your downloads section.
>>
>> On Dec 16= , 2009, at 2:13 PM, David Bastedo wrote:
>>
>>> what does: Math to use Date Display F= ormat? do in the
>>>config? it is set to no?
>>>
>>> On Wed, Dec 16, 2009 at 5:08 = PM, Bob Minor
>>><bob@cybermill.com> wrote:
>>> Works on my servers, must be a config issue!
&g= t;>>
>>> On Dec 16, 2009, at 3:58 PM, Dan Strong wrote:
>>>
>>> > What is = your date format set to in your WebDNA admin?
>>>Mine is "Month/Date/Year (American)"?
>>> >= ;
>>> > -Dan Strong
>>> > http://www.DanStrong.com
>>> >=
>>> > On 12/16/2009 1:55 PM, David Bastedo wrote:
>>> >> So when I put that code on = my server, I get 3909 as
>>>the year. I have
>>> >> tried it on two different servers, = so I am not sure
>>>what is up.
>>> >>
>>> >> -----
>>&g= t; >> [math]val=3D1252257406*1[/math] =3D [math
>>>date]{01/01/1970} + {[format
>>> >&g= t; days_to_date %m/%d/%Y][format
>>> >>
>>>.6d][math]([val]/86400)[/math][/format][/format]= }[/math]
>>> >> 1252257406=3D09/06/3909
>>> >>
>>> >>= I have deconstructed the original time stamp to:
>>> >>
>>> >>
>>> >= ;> [Math
>>> >>
>>>show=3Df]subTotal=3D[math]{09/14/2009}[/math]-[math]{01/0= 1/1970}[/math][/math]
>>> >> total time + days + 1 day - 5 hours
>>> >>
>>= >=3D[math]([subTotal]*86400)+{06:08:54}+86400-18000[/math]=3D
>&= gt;> >> [reaction_published]
>>> >>
>>> &g= t;> so technically, if I do this in the reverse, I should
>>>get what I need . . .
>>> &= gt;>
>>> >> d.
>>> >>
>>> >>
>>> >= >
>>> >>
>>> >>
>>> >>
>>> >> On Wed, Dec 16= , 2009 at 4:01 PM, Marc Thompson
>>><mthompson@media.utah.edu
>>> >> <= ;mailto:mthompson@media.utah.edu>> wrote:
>>> >>
>>> >> Not sure what= the "+1" is for from Dan's example
>>>besides adding an extra
>>> >> day? = However, I put the code on my server so you
>>>could see it working.
>>> >> http://= webapps.utah.edu/test/temp.tpl
>>> >>
>>> >> Seems to work fine on my server, whi= ch is -7DST.
>>> >>
>>> >> You would need to add some more form= atting code to
>>>get it in the form
>>> >> you show in your previous post.
>&= gt;> >> ie. The timestamp 1252976934 corresponds to
>>>2009/09/14 06:08:54 pm PDT.
= >>> >>
>>> >>=20 Marc
>>> >>
>>> >> David Bastedo= wrote:
>>> >> > Unfortunately, I get: 09/16/3909 with the code
>>>below:>>> >> >
>>> >> > I'm trying to work through this . . .
>>> &= gt;> >
>>> >> =20 > d.
>>> >> >
>>> >> &g= t;
>>> >> > On Wed, Dec 16, 2009 at 11:17 AM, Marc Thompson
>>> >> >= <mthompson@media.utah.edu
>>><mailto:mthompson@media.utah.edu>
>>> &= gt;> <mailto:mthompson@media.utah.edu
>>><mailto:mthompson@media.utah.edu>>>
>&g= t;> >> wrote:
>>> >> >
>>> >> > Here you go:
&= gt;>> >> >
>>> >> > [math]val=3D1252976934*1[/math] =3D [math
>&= gt;>date]{01/01/1970} +
>>> >> {[format
>>> >> > days_to_date %m/%d/%Y][= format
>>> >> >
>>> .6d][math]([val]/86400)+1[/math][/format][/format]}[/= math]
>>> >> =20 >
>>> >> > Marc
>>> >> = >
>>> >> > =20 David Bastedo wrote:
>>> >> > > The timestamp= *1252976934* corresponds to*
>>>2009/09/14 06:08:54 pm
>>> >> > = PDT*.
>>> >> > >
>>> >> > > this is the time stamp: *1252= 976934*
>>> >> > >
>>> >> > > [format days_to_date %m/%d/%Y= ][format
>>> >> > >
>>>.6d][math]([your_UNIX_timestamp]/86400)+1[/math][/format]= [/format]
>>> >> > >
>>> >> > > gets me: 09/16/39
>>= > >> > >
>>> >> > > d.
>>> >> > >
>&= gt;> >> > > On Tue, Dec 15, 2009 at 6:54 PM, Dan Strong
>>> >> <webdna@danstr= ong.com
>>><mailto:webdna@danstrong.com>
>>&g= t; >> > <mailto:webdna@danstrong.com
>>><mai= lto:webdna@danstrong.com>>
>>> >> > > <mailto:webdna@danstrong.com
>>>&l= t;mailto:webdna@danstrong.com>
>>> >> <mailto:webdna@danstrong.com
>>><mailto:we= bdna@danstrong.com>>>> wrote:
>>> >> > >
>>> >> = > > Try this:
>>> >> > >
>>> >> > > [format= days_to_date %m/%d/%Y][format
>>> >> > >
>>> >>
>>> .6d][m= ath]([your_UNIX_timestamp]/86400)+1[/math][/format][/format]
>>&= gt; >> > >
>>> >> > >
>>= > >> > >
>>> >> > > On 12/15/2009 3:47 PM, David Bastedo
>&= gt;>wrote:
>>> >> > >
>>> >> > > Hi, I need to convert= a date stored
>>>in unix format -
>>> >> seconds
>>> >> > &= gt; since Jan
>>> >>=20 > > 01, 1970. Is there a formula or
>>>func= tion that anybody
>>> >> =20 > might have?
>>> >> > >
>>&g= t; >> > > I am pulling in an xml file generated
>>>by an external
>>> &= gt;> api and
>>> >> =20 > > that date
>>> >> > > = comes in this format.
>>> >> > >
>>> >> > > tha= nks.
>>> >> > >
>>> >> > > d.
>>> &g= t;> > >
>>> >> =20 > >
>>> >> > > --
>>= > >> > > David Bastedo
>>>
>> <brainepoch.zip>
>
<= br>=A0
"Terry Wilson"

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:

[TaxableTotal] - not working with AOL and IE (1997) WebCat2b12 - nesting [tags] (1997) Nested tags count question (1997) Running 2 two WebCatalog.acgi's (1996) Caching pages...again (2001) More on the email templates (1997) WebCat2: Found Items syntax, etc. (1997) Running WebCat from a CD-ROM (1997) Is a cart really unique? (2002) WebDNA on Windows (2003) Fun with dates (1997) b12 cannot limit records returned and more. (1997) final on include (1997) WC2b15 File Corruption (1997) This list needs a digest: rant, rave... (1997) Multiple prices (1997) Emailer port change (1997) [isfile] ? (1997) Lookup Notfound (1998) template includes encrypted template (1999)