datetime issue

pandora.koura at gmail.com pandora.koura at gmail.com
Sun Sep 16 11:43:14 EDT 2012


Τη Κυριακή, 16 Σεπτεμβρίου 2012 4:23:02 μ.μ. UTC+3, ο χρήστης Günther Dietrich έγραψε:
> In article <cdf072b2-7359-4417-b1e4-d984e4317091 at googlegroups.com>,
> 
>  Νικόλαος Κούρας <nikos.gr33k at gmail.com> wrote:
> 
> 
> 
> [...]
> 
> 
> 
> >also it would be nice if datetime.datetime.now(GMT+2) can be used.
> 
> 
> 
> In <news:mailman.774.1347735926.27098.python-list at python.org>, one of 
> 
> the first answers to your question you were pointed to pytz. This module 
> 
> does exactly what you ask for:
> 
> 
> 
> >>> import datetime
> 
> >>> import pytz
> 
> >>> greek_date = datetime.datetime.now(pytz.timezone('Europe/Athens'))
> 
> >>> greek_date
> 
> >>> print(greek_date)
> 
> 
> 
> If you do a help(pytz), obviously after having imported pytz, you will 
> 
> get some information about the module. At the end of this help, there 
> 
> are some attributes listed. One of them is all_timezones. Guess what it 
> 
> contains?
> 
> 
> 
> 
> 
> 
> 
> Best regards,
> 
> 
> 
> Günther
> 
> 
> 
> 
> 
> 
> 
> 
> 
> PS: I didn't know pytz yet. But it took me just five minutes of reading 
> 
> the datetime documentation and trying pytz.timezone(), to get a working 
> 
> example.
> 
> So I don't understand, why you didn't follow the proposal of trying 
> 
> pytz, but claimed, it wouldn't work.
> 
> Can you explain, why ist doesn't work for you rsp. what is the error 
> 
> when it doesn't work?

import pytz fails in my webhost unfortunately :(
This module is not supported by hostgator.



More information about the Python-list mailing list