RFC2822 Date formats...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC2822 Date formats...

talios@gmail.com
Hey all, just trying to return a timestamp in RFC2822 format (well, the
format used in RFC2822 messages ), but I don't seem to be getting any
timezone info out :(

TimeStamp>>#printRFC2822StringOn: stream
    #swAdded.
    stream
        nextPutAll: (Date shortNameOfDay: self date weekdayIndex);
        nextPutAll: ', '.
    self date printOn: stream format: 'dd MMM yyyy'.
    stream space.
    self time printOn: stream format: 'HH:mm:ss Z'


In other languages, Z would generally return +1200 for my timezone, in
Dolphin, it just gives "Z".

Can't seem to spot anything on google about timezone information :(


Reply | Threaded
Open this post in threaded view
|

Re: RFC2822 Date formats...

Chris Uppal-3
Mark Derricutt wrote:

> Can't seem to spot anything on google about timezone information :(

Time formatting ultimately comes down to the Windows function GetTimeFormat(),
which is documented here:

    http://msdn.microsoft.com/library/en-us/intl/nls_6at0.asp

It looks to me as if you are going to have to go grubbing around in the info
returned by

    Local user getTimeZoneInfo

in which case, you may find it helpful to review this thread:

    http://groups.google.co.uk/groups?threadm=2rq7thF1cod9uU1%40uni-berlin.de


> In other languages, Z would generally return +1200 for my timezone, in
> Dolphin, it just gives "Z".

Out of curiosity, what systems understand a 'Z' in this context ?  The only
other date formatting that I'm familiar with is Unix-style strftime() (and
languages/systems that use that internally), where %Z means the timezone name
(%z seems to be available on some systems -- but not Windows -- as a GNU
extension, where it means the offset from UTC).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: RFC2822 Date formats...

talios@gmail.com
Chris Uppal wrote:

>in which case, you may find it helpful to review this thread:
>
>    http://groups.google.co.uk/groups?threadm=2rq7thF1cod9uU1%40uni-berlin.de
>
>  
>
*reads*

>Out of curiosity, what systems understand a 'Z' in this context ?  The only
>  
>
I know Java does for one...


Reply | Threaded
Open this post in threaded view
|

Re: RFC2822 Date formats...

talios@gmail.com
In reply to this post by talios@gmail.com
Mark Derricutt wrote:

> Can't seem to spot anything on google about timezone information :(

    bias := Time fromSeconds: Locale userDefault timeZoneInformation
second bias * 60.
    hours := '+' , (bias hours printStringRadix: 10 padTo: 2)
                , (bias minutes printStringRadix: 10 padTo: 2).

That seems to hit the spot.  giving me +1200 for my timezone.