Date time iso8601 format

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

Date time iso8601 format

laurent laffont
Hi,

I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?


Cheers,

Laurent Laffont

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

Johan Brichau-2
Laurent,

DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream

Does that yield what you want?

cheers
Johan

On 06 Nov 2010, at 15:07, laurent laffont wrote:

Hi,

I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?


Cheers,

Laurent Laffont

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

laurent laffont
The other way. For example

DateAndTime now printISO8601   

Laurent


On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
Laurent,

DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream

Does that yield what you want?

cheers
Johan

On 06 Nov 2010, at 15:07, laurent laffont wrote:

Hi,

I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?


Cheers,

Laurent Laffont

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/


Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

laurent laffont

On Sun, Nov 7, 2010 at 1:50 PM, laurent laffont <[hidden email]> wrote:
The other way. For example

DateAndTime now printISO8601   

Laurent


It seems Chronos http://chronos-st.org/ has such formatters (ISO8601PrintPolicy) but AnsiStandardCalendarClock is missing in Pharo....

Laurent
 


On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
Laurent,

DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream

Does that yield what you want?

cheers
Johan

On 06 Nov 2010, at 15:07, laurent laffont wrote:

Hi,

I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?


Cheers,

Laurent Laffont

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/



Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

Stéphane Ducasse
In reply to this post by laurent laffont

On Nov 7, 2010, at 1:55 PM, laurent laffont wrote:

>
> On Sun, Nov 7, 2010 at 1:50 PM, laurent laffont <[hidden email]> wrote:
> The other way. For example
>
> DateAndTime now printISO8601  
>
> Laurent
>
>
> It seems Chronos http://chronos-st.org/ has such formatters (ISO8601PrintPolicy) but AnsiStandardCalendarClock is missing in Pharo....

Why do you mean missing in pharo?
When you load chronos this is not there.
May be you should contact the author and ask.

>
> Laurent
>  
>
>
> On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
> Laurent,
>
> DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream
>
> Does that yield what you want?
>
> cheers
> Johan
>
> On 06 Nov 2010, at 15:07, laurent laffont wrote:
>
>> Hi,
>>
>> I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?
>>
>>
>> Cheers,
>>
>> Laurent Laffont
>>
>> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
>> Blog: http://magaloma.blogspot.com/
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

Johan Brichau-2
In reply to this post by laurent laffont
When I evaluate:

DateAndTime now printString

->  '2010-11-07T20:42:26+01:00'

On 07 Nov 2010, at 13:50, laurent laffont wrote:

> The other way. For example
>
> DateAndTime now printISO8601  
>
> Laurent
>
>
> On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
> Laurent,
>
> DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream
>
> Does that yield what you want?
>
> cheers
> Johan
>
> On 06 Nov 2010, at 15:07, laurent laffont wrote:
>
>> Hi,
>>
>> I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?
>>
>>
>> Cheers,
>>
>> Laurent Laffont
>>
>> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
>> Blog: http://magaloma.blogspot.com/
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

laurent laffont
On Sun, Nov 7, 2010 at 8:43 PM, Johan Brichau <[hidden email]> wrote:
When I evaluate:

DateAndTime now printString

->  '2010-11-07T20:42:26+01:00'

Sometimes I feel stupid :)  Thank you Johan.

Indeed Amazon WS keeps telling me my TimeStamp is not in iso 8601 format. I've tried to encodeForHTTP but then it tells Signature is invalid....  the sample I'm trying to get PBE entry from Amazon:


req :=  'Service=AWSECommerceService&AWSAccessKeyId=mykey&Operation=ItemLookup&ItemId=3952334146&Timestamp=', DateAndTime now printString.
sign :=SHA256 hashMessage:  'GET', String crlf, 'ecs.amazonaws.com', String crlf, '/onca/xml',String crlf,req.


(Url absoluteFromText: 'http://webservices.amazon.fr/onca/xml?',req, '&Signature=',sign hex) retrieveContents contentStream.

Laurent
 

On 07 Nov 2010, at 13:50, laurent laffont wrote:

> The other way. For example
>
> DateAndTime now printISO8601
>
> Laurent
>
>
> On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
> Laurent,
>
> DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream
>
> Does that yield what you want?
>
> cheers
> Johan
>
> On 06 Nov 2010, at 15:07, laurent laffont wrote:
>
>> Hi,
>>
>> I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?
>>
>>
>> Cheers,
>>
>> Laurent Laffont
>>
>> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
>> Blog: http://magaloma.blogspot.com/
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Date time iso8601 format

NorbertHartl

On 07.11.2010, at 23:07, laurent laffont wrote:

On Sun, Nov 7, 2010 at 8:43 PM, Johan Brichau <[hidden email]> wrote:
When I evaluate:

DateAndTime now printString

->  '2010-11-07T20:42:26+01:00'

Sometimes I feel stupid :)  Thank you Johan.

Indeed Amazon WS keeps telling me my TimeStamp is not in iso 8601 format. I've tried to encodeForHTTP but then it tells Signature is invalid....  the sample I'm trying to get PBE entry from Amazon:


req :=  'Service=AWSECommerceService&AWSAccessKeyId=mykey&Operation=ItemLookup&ItemId=3952334146&Timestamp=', DateAndTime now printString.
sign :=SHA256 hashMessage:  'GET', String crlf, 'ecs.amazonaws.com', String crlf, '/onca/xml',String crlf,req.


(Url absoluteFromText: 'http://webservices.amazon.fr/onca/xml?',req, '&Signature=',sign hex) retrieveContents contentStream.

Wenn did you do the encodeForHTTP? You need it in any case because at least the + sign is an encoded space that will render the date invalid. I think you need do safe url encoding only for the string if it is included in the url not the hash.

Norbert

 

On 07 Nov 2010, at 13:50, laurent laffont wrote:

> The other way. For example
>
> DateAndTime now printISO8601
>
> Laurent
>
>
> On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
> Laurent,
>
> DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream
>
> Does that yield what you want?
>
> cheers
> Johan
>
> On 06 Nov 2010, at 15:07, laurent laffont wrote:
>
>> Hi,
>>
>> I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?
>>
>>
>> Cheers,
>>
>> Laurent Laffont
>>
>> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
>> Blog: http://magaloma.blogspot.com/
>
>