datetime issue
Jason Friedman
jason at powerpull.net
Sat Sep 15 14:58:13 EDT 2012
> # get some enviromental values
> locale.setlocale(locale.LC_ALL, 'el_GR')
> date = datetime.datetime.now().strftime( '%y-%m-%d %H:%M:%S' )
>
> although iam setting greek as locale the time is 8 hours before, like in texas, us
> How can i change this to save the correct Greek time in variable $date ?
http://docs.python.org/py3k/library/datetime.html#tzinfo-objects
http://stackoverflow.com/questions/117514/how-do-i-use-timezones-with-a-datetime-object-in-python
http://pytz.sourceforge.net/
Reading these links suggests that datetime.now() will return the
system time regardless of your locale setting.
Use a timezone to generate a timestamp for someplace other than where
your server sits.
More information about the Python-list
mailing list