datetime issue
Νικόλαος Κούρας
nikos.gr33k at gmail.com
Sat Sep 15 15:26:53 EDT 2012
Τη Σάββατο, 15 Σεπτεμβρίου 2012 10:05:49 μ.μ. UTC+3, ο χρήστης Chris Rebert έγραψε:
> On Sat, Sep 15, 2012 at 10:33 AM, Νικόλαος Κούρας <nikos.gr33k at gmail.com> wrote:
>
> > Hello again,
>
> >
>
> > one small matter too.
>
>
>
> > # get some enviromental values
>
> > locale.setlocale(locale.LC_ALL, 'el_GR')
>
> <snip>
>
> > date = datetime.datetime.now().strftime( '%y-%m-%d %H:%M:%S' )
>
> >
>
> > although iam setting greek as locale
>
>
>
> Locales don't affect timezones. Otherwise, how would expatriate
>
> communities, or countries wide enough to span several timezones,
>
> properly configure their software?
>
>
>
> > the time is 8 hours before, like in texas, us
>
>
>
> Which is where HostGator operates out of.
>
>
>
> > How can i change this to save the correct Greek time in variable $date ?
>
>
>
> Use the `pytz` package that Jason pointed out.
>
>
>
> Cheers,
>
> Chris
I did read but wasnt able to set it to greek time.
Please tell me how should i write this.
date = datetime.datetime.now().strftime( '%y-%m-%d %H:%M:%S',gmt+2 )
didnt work out for me.
More information about the Python-list
mailing list