Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

A basic question

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


giampiero.benvenuti at chiaroscuro

Jul 14, 2012, 5:53 AM

Post #1 of 3 (541 views)
Permalink
A basic question

Hello,

I have a python script in my zope instance:

dt=DateTime(2012,1)
print dt
print dt.strftime('%Y')
print dt.year()

return printed
2012/01/01 00:00:00 GMT+2
2011
2012


Why do I get two different values for the year (2011, 2012)?

Thank you,


Giampiero
_______________________________________________
Zope maillist - Zope [at] zope
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )


thy at 42

Jul 14, 2012, 6:54 AM

Post #2 of 3 (515 views)
Permalink
Re: A basic question [In reply to]

On Sat, Jul 14, Giampiero Benvenuti wrote:
> I have a python script in my zope instance:
>
> dt=DateTime(2012,1)
> print dt
> print dt.strftime('%Y')
> print dt.year()
>
> return printed
> 2012/01/01 00:00:00 GMT+2
> 2011
> 2012
>
> Why do I get two different values for the year (2011, 2012)?

It would seem strftime defaults to a timezone "to the left" of GMT+2.

\\kristian
--
... et nemo ex vobis interrogat me: "Quo vadis?"
_______________________________________________
Zope maillist - Zope [at] zope
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )


akm at theinternet

Jul 14, 2012, 7:08 AM

Post #3 of 3 (516 views)
Permalink
Re: A basic question [In reply to]

+-------[ Kristian Thy ]----------------------
| On Sat, Jul 14, Giampiero Benvenuti wrote:
| > I have a python script in my zope instance:
| >
| > dt=DateTime(2012,1)
| > print dt
| > print dt.strftime('%Y')
| > print dt.year()
| >
| > return printed
| > 2012/01/01 00:00:00 GMT+2
| > 2011
| > 2012
| >
| > Why do I get two different values for the year (2011, 2012)?
|
| It would seem strftime defaults to a timezone "to the left" of GMT+2.

strftime converts to UTC

--
Andrew Milton
akm [at] theinternet
_______________________________________________
Zope maillist - Zope [at] zope
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.