In article <cdf072b2-7359-4417-b1e4-d984e4317...@googlegroups.com>,
 Νικόλαος Κούρας <nikos.gr...@gmail.com> wrote:

[...]

>also it would be nice if datetime.datetime.now(GMT+2) can be used.

In <news:mailman.774.1347735926.27098.python-l...@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?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to