Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29263 > unrolled thread

datetime issue

Started byΝικόλαος Κούρας <nikos.gr33k@gmail.com>
First post2012-09-15 10:33 -0700
Last post2012-09-15 12:26 -0700
Articles 20 on this page of 133 — 38 participants

Back to article view | Back to comp.lang.python


Contents

  datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:33 -0700
    Re: datetime issue Jason Friedman <jason@powerpull.net> - 2012-09-15 12:58 -0600
    Re: datetime issue Chris Rebert <clp2@rebertia.com> - 2012-09-15 12:05 -0700
      Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 12:26 -0700
        Re: datetime issue MRAB <python@mrabarnett.plus.com> - 2012-09-15 21:28 +0100
          Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 22:15 -0700
            Re: datetime issue Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-16 01:53 -0400
              Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 00:51 -0700
                Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 01:18 -0700
                Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 01:18 -0700
              Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 00:51 -0700
              Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 01:25 -0700
                Re: datetime issue Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 09:53 +0000
                  Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 03:15 -0700
                    Re: datetime issue Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 10:49 +0000
                      Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 03:54 -0700
                        Re: datetime issue Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 11:34 +0000
                          Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 04:56 -0700
                            Re: datetime issue Dave Angel <d@davea.name> - 2012-09-16 15:31 -0400
                    Obnoxious postings from Google Groups (was: datetime issue) Ben Finney <ben+python@benfinney.id.au> - 2012-09-16 23:18 +1000
                      Re: Obnoxious postings from Google Groups (was: datetime issue) pandora.koura@gmail.com - 2012-09-16 08:41 -0700
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Joel Goldstick <joel.goldstick@gmail.com> - 2012-09-16 11:57 -0400
                          Re: Obnoxious postings from Google Groups (was: datetime issue) pandora.koura@gmail.com - 2012-09-16 09:06 -0700
                            Re: Obnoxious postings from Google Groups (was: datetime issue) Joel Goldstick <joel.goldstick@gmail.com> - 2012-09-16 12:23 -0400
                            Re: Obnoxious postings from Google Groups (was: datetime issue) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 16:54 +0000
                            Re: Obnoxious postings from Google Groups Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-16 20:26 +0100
                            Re: Obnoxious postings from Google Groups (was: datetime issue) Gene Heskett <gheskett@wdtv.com> - 2012-09-16 12:32 -0400
                          Re: Obnoxious postings from Google Groups (was: datetime issue) pandora.koura@gmail.com - 2012-09-16 09:06 -0700
                        Re: Obnoxious postings from Google Groups Terry Reedy <tjreedy@udel.edu> - 2012-09-16 12:30 -0400
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-16 16:52 +0000
                        Re: Obnoxious postings from Google Groups Mayuresh Kathe <mayuresh@kathe.in> - 2012-09-17 01:09 +0530
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Jamie Paul Griffin <jamie@kode5.net> - 2012-09-17 14:28 +0100
                      Re: Obnoxious postings from Google Groups (was: datetime issue) pandora.koura@gmail.com - 2012-09-16 08:44 -0700
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Chris Angelico <rosuav@gmail.com> - 2012-09-17 01:57 +1000
                          Re: Obnoxious postings from Google Groups (was: datetime issue) pandora.koura@gmail.com - 2012-09-16 09:02 -0700
                          Re: Obnoxious postings from Google Groups (was: datetime issue) pandora.koura@gmail.com - 2012-09-16 09:02 -0700
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Gene Heskett <gheskett@wdtv.com> - 2012-09-16 12:28 -0400
                        Re: Obnoxious postings from Google Groups Robert Miles <robertmiles@teranews.com> - 2012-10-31 00:18 -0500
                      Re: Obnoxious postings from Google Groups (was: datetime issue) alex23 <wuwei23@gmail.com> - 2012-09-16 17:47 -0700
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Roy Smith <roy@panix.com> - 2012-09-16 20:55 -0400
                          Re: Obnoxious postings from Google Groups (was: datetime issue) alex23 <wuwei23@gmail.com> - 2012-09-16 18:14 -0700
                            Re: Obnoxious postings from Google Groups Robert Miles <robertmiles@teranews.com> - 2012-10-31 00:39 -0500
                              Re: Obnoxious postings from Google Groups Jamie Paul Griffin <jamie@kode5.net> - 2012-11-01 09:55 +0000
                                Re: Obnoxious postings from Google Groups rurpy@yahoo.com - 2012-11-01 15:08 -0700
                                  Re: Obnoxious postings from Google Groups Chris Angelico <rosuav@gmail.com> - 2012-11-02 10:32 +1100
                                    Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-02 01:25 +0000
                                      Re: Obnoxious postings from Google Groups Roy Smith <roy@panix.com> - 2012-11-01 21:42 -0400
                                      Re: Obnoxious postings from Google Groups "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2012-11-02 02:07 +0000
                                      Re: Obnoxious postings from Google Groups Grant Edwards <invalid@invalid.invalid> - 2012-11-02 14:11 +0000
                                  Re: Obnoxious postings from Google Groups Jamie Paul Griffin <jamie@kode5.net> - 2012-11-02 09:36 +0000
                                    Re: Obnoxious postings from Google Groups rurpy@yahoo.com - 2012-11-02 11:39 -0700
                                      Re: Obnoxious postings from Google Groups Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-03 00:06 +0000
                                      Re: Obnoxious postings from Google Groups Jamie Paul Griffin <jamie@kode5.net> - 2012-11-04 11:13 +0000
                                        Re: Obnoxious postings from Google Groups rusi <rustompmody@gmail.com> - 2012-11-04 22:10 -0800
                                          Re: Obnoxious postings from Google Groups Chris Angelico <rosuav@gmail.com> - 2012-11-05 17:39 +1100
                                            Re: Obnoxious postings from Google Groups rusi <rustompmody@gmail.com> - 2012-11-04 23:34 -0800
                                            Re: Obnoxious postings from Google Groups Roy Smith <roy@panix.com> - 2012-11-05 07:56 -0500
                                              Re: Obnoxious postings from Google Groups Chris Angelico <rosuav@gmail.com> - 2012-11-06 01:20 +1100
                                              Re: Obnoxious postings from Google Groups Grant Edwards <invalid@invalid.invalid> - 2012-11-05 14:59 +0000
                                                RE: Obnoxious postings from Google Groups "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-06 16:52 +0000
                                            Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-06 05:03 +0000
                                              Re: Obnoxious postings from Google Groups Roy Smith <roy@panix.com> - 2012-11-06 08:52 -0500
                                                Re: Obnoxious postings from Google Groups GangGreene <GangGreene@example.com> - 2012-11-06 11:51 -0500
                                                  Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-06 23:14 +0000
                                                    Re: Obnoxious postings from Google Groups GangGreene <GangGreene@example.com> - 2012-11-06 19:16 -0500
                                                    Re: Obnoxious postings from Google Groups Grant Edwards <invalid@invalid.invalid> - 2012-11-07 15:13 +0000
                                              Re: Obnoxious postings from Google Groups Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2012-11-07 18:52 +1300
                                                Re: Obnoxious postings from Google Groups Roy Smith <roy@panix.com> - 2012-11-07 01:04 -0500
                                                Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-07 08:15 +0000
                                          Re: Obnoxious postings from Google Groups Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-05 11:28 -0500
                                            Re: Obnoxious postings from Google Groups Grant Edwards <invalid@invalid.invalid> - 2012-11-05 18:20 +0000
                                              Re: Obnoxious postings from Google Groups Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-05 14:47 -0500
                                                Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-06 04:46 +0000
                                                  RE: Obnoxious postings from Google Groups "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-06 17:16 +0000
                                                    Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-06 22:50 +0000
                                                      RE: Obnoxious postings from Google Groups "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-06 23:08 +0000
                                                        Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-07 00:13 +0000
                                                          Re: Obnoxious postings from Google Groups Hans Mulder <hansmu@xs4all.nl> - 2012-11-09 12:34 +0100
                                                            Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-10 06:57 +0000
                                                      RE: Obnoxious postings from Google Groups Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2012-11-07 15:08 +0530
                                                      Re: Obnoxious postings from Google Groups Hans Mulder <hansmu@xs4all.nl> - 2012-11-09 10:49 +0100
                                                        Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-09 11:30 +0000
                                        Re: Obnoxious postings from Google Groups rurpy@yahoo.com - 2012-11-05 11:41 -0800
                                      Re: Obnoxious postings from Google Groups Virgil Stokes <vs@it.uu.se> - 2012-11-04 17:52 +0100
                                    Re: Obnoxious postings from Google Groups Bob Martin <bob.martin@excite.com> - 2012-11-03 07:44 +0000
                                      Re: Obnoxious postings from Google Groups Dave Angel <d@davea.name> - 2012-11-03 10:24 -0400
                                        Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-03 16:18 +0000
                                      Re: Obnoxious postings from Google Groups Chris Angelico <rosuav@gmail.com> - 2012-11-04 03:05 +1100
                                  Re: Obnoxious postings from Google Groups Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-02 11:42 -0600
                              Re: Obnoxious postings from Google Groups Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-04 18:39 +0000
                              Re: Obnoxious postings from Google Groups Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-11-09 12:02 +0100
                      Re: Obnoxious postings from Google Groups Robert Miles <robertmiles@teranews.com> - 2012-09-21 00:22 -0500
                      Re: Obnoxious postings from Google Groups (was: datetime issue) Grant Edwards <invalid@invalid.invalid> - 2012-09-21 15:07 +0000
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Walter Hurry <walterhurry@lavabit.com> - 2012-09-21 22:11 +0000
                        Re: Obnoxious postings from Google Groups (was: datetime issue) Hank Gay <hank.gay+eternal.september@gmail.com> - 2012-09-21 20:51 -0400
                          Re: Obnoxious postings from Google Groups (was: datetime issue) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-22 00:13 -0400
                          Re: Obnoxious postings from Google Groups (was: datetime issue) Grant Edwards <invalid@invalid.invalid> - 2012-09-23 22:25 +0000
                      Re: Obnoxious postings from Google Groups Robert Miles <robertmiles@teranews.com> - 2012-10-31 00:07 -0500
                        Re: Obnoxious postings from Google Groups rurpy@yahoo.com - 2012-10-31 12:32 -0700
                          Re: Obnoxious postings from Google Groups Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-31 22:33 +0000
                            Re: Obnoxious postings from Google Groups Arnaud Delobelle <arnodel@gmail.com> - 2012-10-31 23:58 +0000
                            Re: Obnoxious postings from Google Groups Jamie Paul Griffin <jamie@kode5.net> - 2012-11-01 09:44 +0000
                    Re: datetime issue Roy Smith <roy@panix.com> - 2012-09-16 09:22 -0400
                      Re: datetime issue Chris Angelico <rosuav@gmail.com> - 2012-09-16 23:32 +1000
                        Re: datetime issue Chris Angelico <rosuav@gmail.com> - 2012-09-17 00:10 +1000
                        gc.get_objects() Matteo Boscolo <matteo.boscolo@boscolini.eu> - 2012-09-17 14:42 +0200
                          Re: gc.get_objects() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-17 14:16 +0000
                            Re: gc.get_objects() Chris Angelico <rosuav@gmail.com> - 2012-09-18 02:09 +1000
                            Re: gc.get_objects() Matteo Boscolo <matteo.boscolo@boscolini.eu> - 2012-09-17 19:23 +0200
                            Re: gc.get_objects() Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-09-17 17:43 +0000
                    Re: datetime issue Grant Edwards <invalid@invalid.invalid> - 2012-10-31 15:11 +0000
                      Re: datetime issue rurpy@yahoo.com - 2012-10-31 12:35 -0700
                        Re: datetime issue Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-31 21:38 +0000
                          Re: datetime issue Robert Miles <robertmiles@teranews.com> - 2012-10-31 19:23 -0500
                            Re: datetime issue Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-01 00:36 +0000
                          Re: datetime issue rurpy@yahoo.com - 2012-11-01 15:00 -0700
                            Re: datetime issue Jamie Paul Griffin <jamie@kode5.net> - 2012-11-02 09:57 +0000
                              Re: datetime issue rurpy@yahoo.com - 2012-11-02 11:43 -0700
                        Re: datetime issue Robert Miles <robertmiles@teranews.com> - 2012-10-31 19:09 -0500
                        Re: datetime issue Grant Edwards <invalid@invalid.invalid> - 2012-11-01 12:09 +0000
                          Re: datetime issue rurpy@yahoo.com - 2012-11-01 15:28 -0700
                Re: datetime issue "Günther Dietrich" <gd.usenet@spamfence.net> - 2012-09-16 15:22 +0200
                  Re: datetime issue pandora.koura@gmail.com - 2012-09-16 08:43 -0700
                    Re: datetime issue Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-16 15:35 -0400
                Re: datetime issue MRAB <python@mrabarnett.plus.com> - 2012-09-16 16:27 +0100
                  Re: datetime issue pandora.koura@gmail.com - 2012-09-16 08:40 -0700
                    Re: datetime issue Chris Angelico <rosuav@gmail.com> - 2012-09-17 01:54 +1000
                    Re: datetime issue Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-16 20:23 +0100
                  Re: datetime issue pandora.koura@gmail.com - 2012-09-16 08:40 -0700
                Re: datetime issue Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-16 15:37 -0400
              Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-16 01:25 -0700
          Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 22:15 -0700
      Re: datetime issue Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 12:26 -0700

Page 1 of 7  [1] 2 3 4 5 6 7  Next page →


#29263 — datetime issue

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 10:33 -0700
Subjectdatetime issue
Message-ID<fb821c53-c786-4795-8f57-70d2eede03fe@googlegroups.com>
Hello again,

one small matter too.

# 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 ?

Thank you.

[toc] | [next] | [standalone]


#29271

FromJason Friedman <jason@powerpull.net>
Date2012-09-15 12:58 -0600
Message-ID<mailman.773.1347735495.27098.python-list@python.org>
In reply to#29263
> # 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.

[toc] | [prev] | [next] | [standalone]


#29272

FromChris Rebert <clp2@rebertia.com>
Date2012-09-15 12:05 -0700
Message-ID<mailman.774.1347735926.27098.python-list@python.org>
In reply to#29263
On Sat, Sep 15, 2012 at 10:33 AM, Νικόλαος Κούρας <nikos.gr33k@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

[toc] | [prev] | [next] | [standalone]


#29273

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 12:26 -0700
Message-ID<52847c35-388c-4758-b72d-1d1859b788a3@googlegroups.com>
In reply to#29272
Τη Σάββατο, 15 Σεπτεμβρίου 2012 10:05:49 μ.μ. UTC+3, ο χρήστης Chris Rebert έγραψε:
> On Sat, Sep 15, 2012 at 10:33 AM, Νικόλαος Κούρας <nikos.gr33k@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.

[toc] | [prev] | [next] | [standalone]


#29275

FromMRAB <python@mrabarnett.plus.com>
Date2012-09-15 21:28 +0100
Message-ID<mailman.776.1347740899.27098.python-list@python.org>
In reply to#29273
On 2012-09-15 20:26, Νικόλαος Κούρας wrote:
> Τη Σάββατο, 15 Σεπτεμβρίου 2012 10:05:49 μ.μ. UTC+3, ο χρήστης Chris Rebert έγραψε:
>> On Sat, Sep 15, 2012 at 10:33 AM, Νικόλαος Κούρας <nikos.gr33k@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.
 >>
 > 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.
 >
Does this help?

import datetime

# The time as UTC (GMT).
now_utc = datetime.datetime.utcnow()
print(now_utc.strftime('%Y-%m-%d %H:%M:%S'))

# The time as UTC+2.
now_local = now_utc + datetime.timedelta(hours=2)
print(now_local.strftime('%Y-%m-%d %H:%M:%S'))

[toc] | [prev] | [next] | [standalone]


#29280

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 22:15 -0700
Message-ID<8370412f-5176-45ff-87eb-72cbca5149d5@googlegroups.com>
In reply to#29275
Τη Σάββατο, 15 Σεπτεμβρίου 2012 11:28:47 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:
> On 2012-09-15 20:26, οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ wrote:
> 
> > οΏ½οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½, 15 οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ 2012 10:05:49 οΏ½.οΏ½. UTC+3, οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ Chris Rebert οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½:
> 
> >> On Sat, Sep 15, 2012 at 10:33 AM, οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ <nikos.gr33k@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.
> 
>  >>
> 
>  > 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.
> 
>  >
> 
> Does this help?
> 
> 
> 
> import datetime
> 
> 
> 
> # The time as UTC (GMT).
> 
> now_utc = datetime.datetime.utcnow()
> 
> print(now_utc.strftime('%Y-%m-%d %H:%M:%S'))
> 
> 
> 
> # The time as UTC+2.
> 
> now_local = now_utc + datetime.timedelta(hours=2)
> 
> print(now_local.strftime('%Y-%m-%d %H:%M:%S'))

If i wanted to alter the following line, how would i write it?

date = datetime.datetime.now()+datetime.timedelta(hours=2).strftime( '%y-%m-%d %H:%M:%S')

But that doesnt work,

[toc] | [prev] | [next] | [standalone]


#29282

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-09-16 01:53 -0400
Message-ID<mailman.781.1347774837.27098.python-list@python.org>
In reply to#29280
On Sat, 15 Sep 2012 22:15:38 -0700 (PDT), Íéêüëáïò Êïýñáò
<nikos.gr33k@gmail.com> declaimed the following in
gmane.comp.python.general:


> 
> If i wanted to alter the following line, how would i write it?
> 
> date = datetime.datetime.now()+datetime.timedelta(hours=2).strftime( '%y-%m-%d %H:%M:%S')
> 
> But that doesnt work,

	What did you expect? Object methods bind tighter than operators so
what you have is the equivalent of

dn = datetime.datetime.now()
dd = datetime.timedelta(hours=2).strftime(...)
date = dn + dd

	Try

>>> import datetime
>>> date = datetime.datetime.now()+datetime.timedelta(hours=2).strftime( '%y-%m-%d %H:%M:%S')
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
AttributeError: 'datetime.timedelta' object has no attribute 'strftime'
>>> date = (datetime.datetime.now()+datetime.timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S')
>>> date
'12-09-16 03:50:44'
>>> 

	Note the ( ) wrapping the the + clause, with strftime() applied to
the result of that...
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#29289

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 00:51 -0700
Message-ID<1774b70d-d3ad-414d-8460-bfa750b8f23f@googlegroups.com>
In reply to#29282
dn = datetime.datetime.now()
dd = datetime.timedelta(hours=2)
date = dn + dd
date = date.strftime( '%y-%m-%d %H:%M:%S' )

still giving me texas,us time for some reason

[toc] | [prev] | [next] | [standalone]


#29293

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 01:18 -0700
Message-ID<30245c49-6166-4860-934b-b9999cb69755@googlegroups.com>
In reply to#29289
Τη Κυριακή, 16 Σεπτεμβρίου 2012 10:51:18 π.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε:
> dn = datetime.datetime.now()
> 
> dd = datetime.timedelta(hours=2)
> 
> date = dn + dd
> 
> date = date.strftime( '%y-%m-%d %H:%M:%S' )
> 
> 
> 
> still giving me texas,us time for some reason

which is same as this:

date = ( datetime.datetime.now() + datetime.timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S')

this also doesnt work either:

date = ( datetime.datetime.now(hours=2).strftime( '%y-%m-%d %H:%M:%S')

if only it would!

[toc] | [prev] | [next] | [standalone]


#29294

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 01:18 -0700
Message-ID<mailman.786.1347783494.27098.python-list@python.org>
In reply to#29289
Τη Κυριακή, 16 Σεπτεμβρίου 2012 10:51:18 π.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε:
> dn = datetime.datetime.now()
> 
> dd = datetime.timedelta(hours=2)
> 
> date = dn + dd
> 
> date = date.strftime( '%y-%m-%d %H:%M:%S' )
> 
> 
> 
> still giving me texas,us time for some reason

which is same as this:

date = ( datetime.datetime.now() + datetime.timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S')

this also doesnt work either:

date = ( datetime.datetime.now(hours=2).strftime( '%y-%m-%d %H:%M:%S')

if only it would!

[toc] | [prev] | [next] | [standalone]


#29290

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 00:51 -0700
Message-ID<mailman.784.1347781887.27098.python-list@python.org>
In reply to#29282
dn = datetime.datetime.now()
dd = datetime.timedelta(hours=2)
date = dn + dd
date = date.strftime( '%y-%m-%d %H:%M:%S' )

still giving me texas,us time for some reason

[toc] | [prev] | [next] | [standalone]


#29295

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 01:25 -0700
Message-ID<cdf072b2-7359-4417-b1e4-d984e4317091@googlegroups.com>
In reply to#29282
Τη Κυριακή, 16 Σεπτεμβρίου 2012 8:53:57 π.μ. UTC+3, ο χρήστης Dennis Lee Bieber έγραψε:
> On Sat, 15 Sep 2012 22:15:38 -0700 (PDT), Íéêüëáïò Êïýñáò
> 
> <nikos.gr33k@gmail.com> declaimed the following in
> 
> gmane.comp.python.general:
> 
> 
> 
> 
> 
> > 
> 
> > If i wanted to alter the following line, how would i write it?
> 
> > 
> 
> > date = datetime.datetime.now()+datetime.timedelta(hours=2).strftime( '%y-%m-%d %H:%M:%S')
> 
> > 
> 
> > But that doesnt work,
> 
> 
> 
> 	What did you expect? Object methods bind tighter than operators so
> 
> what you have is the equivalent of
> 
> 
> 
> dn = datetime.datetime.now()
> 
> dd = datetime.timedelta(hours=2).strftime(...)
> 
> date = dn + dd
> 
> 
> 
> 	Try
> 
> 
> 
> >>> import datetime
> 
> >>> date = datetime.datetime.now()+datetime.timedelta(hours=2).strftime( '%y-%m-%d %H:%M:%S')
> 
> Traceback (most recent call last):
> 
>   File "<interactive input>", line 1, in <module>
> 
> AttributeError: 'datetime.timedelta' object has no attribute 'strftime'
> 
> >>> date = (datetime.datetime.now()+datetime.timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S')
> 
> >>> date
> 
> '12-09-16 03:50:44'
> 
> >>> 
> 
> 
> 
> 	Note the ( ) wrapping the the + clause, with strftime() applied to
> 
> the result of that...
> 
> -- 
> 
> 	Wulfraed                 Dennis Lee Bieber         AF6VN
> 
>         wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/



date = ( datetime.datetime.now() + datetime.timedelta(hours=8) ).strftime( '%y-%m-%d %H:%M:%S')

but iam giving +8 hours which is the time difference between texas, us where the server sits and Greece's time.

cant we somehow tell it to use GMT+2 ?

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

[toc] | [prev] | [next] | [standalone]


#29297

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-09-16 09:53 +0000
Message-ID<5055a1a6$0$29981$c3e8da3$5496439d@news.astraweb.com>
In reply to#29295
On Sun, 16 Sep 2012 01:25:30 -0700, Νικόλαος Κούρας wrote:
[...]

You seem to be emailing python-list AND posting to comp.lang.python (or 
the gmane mirror). Please pick one, or the other, and not both, because 
the mailing list and the newsgroup are mirrors of each other. Anything 
you send to the mailing list will be mirrored on the newsgroup 
automatically, there is no need to manually duplicate the post.


Thank you.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#29298

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 03:15 -0700
Message-ID<4f9d9a0b-539a-4b6a-af3e-b02d1f4006ee@googlegroups.com>
In reply to#29297
Τη Κυριακή, 16 Σεπτεμβρίου 2012 12:53:42 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε:
> On Sun, 16 Sep 2012 01:25:30 -0700, Νικόλαος Κούρας wrote:
> 
> [...]
> 
> 
> 
> You seem to be emailing python-list AND posting to comp.lang.python (or 
> 
> the gmane mirror). Please pick one, or the other, and not both, because 
> 
> the mailing list and the newsgroup are mirrors of each other. Anything 
> 
> you send to the mailing list will be mirrored on the newsgroup 
> 
> automatically, there is no need to manually duplicate the post.
> 
> 
> 
> 
> 
> Thank you.
> 
> 
> 
> 
> 
> -- 
> 
> Steven

Iam sorry i didnt do that on purpose and i dont know how this is done.

Iam positng via google groups using chrome, thats all i know.

Whats a mailing list?
Can i get responses to my mail instead of constantly check the google groups site?

[toc] | [prev] | [next] | [standalone]


#29300

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-09-16 10:49 +0000
Message-ID<5055aec2$0$29981$c3e8da3$5496439d@news.astraweb.com>
In reply to#29298
On Sun, 16 Sep 2012 03:15:11 -0700, Νικόλαος Κούρας wrote:

> Whats a mailing list?
> Can i get responses to my mail instead of constantly check the google
> groups site?

http://mail.python.org/mailman/listinfo/python-list



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#29301

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 03:54 -0700
Message-ID<46626459-facd-4f5f-8907-033b1759b8b4@googlegroups.com>
In reply to#29300
Τη Κυριακή, 16 Σεπτεμβρίου 2012 1:49:38 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε:
> On Sun, 16 Sep 2012 03:15:11 -0700, Νικόλαος Κούρας wrote:
> 
> 
> 
> > Whats a mailing list?
> 
> > Can i get responses to my mail instead of constantly check the google
> 
> > groups site?
> 
> 
> 
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven

Thank you, i prefer to be notifies only to thread iam initiating or answering to not all of te threads. Is this possible?

[toc] | [prev] | [next] | [standalone]


#29302

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-09-16 11:34 +0000
Message-ID<5055b94a$0$29981$c3e8da3$5496439d@news.astraweb.com>
In reply to#29301
On Sun, 16 Sep 2012 03:54:45 -0700, Νικόλαος Κούρας wrote:

> Τη Κυριακή, 16 Σεπτεμβρίου 2012 1:49:38 μ.μ. UTC+3, ο χρήστης Steven
> D'Aprano έγραψε:
>> On Sun, 16 Sep 2012 03:15:11 -0700, Νικόλαος Κούρας wrote:
>> 
>> 
>> 
>> > Whats a mailing list?
>> 
>> > Can i get responses to my mail instead of constantly check the google
>> 
>> > groups site?
>> 
>> 
>> 
>> http://mail.python.org/mailman/listinfo/python-list

> Thank you, i prefer to be notifies only to thread iam initiating or
> answering to not all of te threads. Is this possible?

No. That's not how mailing lists work. Every email gets posted to all 
members, unless they go onto "No Mail", in which case they get no emails 
at all.

You are not paying anything for the help you are receiving, except to 
give your own time in return to help others. We are all volunteers here, 
and nobody is going to force you to volunteer in return, but if everyone 
only received threads that they initiated, nobody would see new threads 
and nobody would get any answers at all.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#29304

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 04:56 -0700
Message-ID<e70f7210-d50e-4157-92d1-7a596bbc410d@googlegroups.com>
In reply to#29302
Τη Κυριακή, 16 Σεπτεμβρίου 2012 2:34:34 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε:
> On Sun, 16 Sep 2012 03:54:45 -0700, Νικόλαος Κούρας wrote:
> 
> 
> 
> > Τη Κυριακή, 16 Σεπτεμβρίου 2012 1:49:38 μ.μ. UTC+3, ο χρήστης Steven
> 
> > D'Aprano έγραψε:
> 
> >> On Sun, 16 Sep 2012 03:15:11 -0700, Νικόλαος Κούρας wrote:
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> > Whats a mailing list?
> 
> >> 
> 
> >> > Can i get responses to my mail instead of constantly check the google
> 
> >> 
> 
> >> > groups site?
> 
> >> 
> 
> >> 
> 
> >> 
> 
> >> http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> > Thank you, i prefer to be notifies only to thread iam initiating or
> 
> > answering to not all of te threads. Is this possible?
> 
> 
> 
> No. That's not how mailing lists work. Every email gets posted to all 
> 
> members, unless they go onto "No Mail", in which case they get no emails 
> 
> at all.
> 
> 
> 
> You are not paying anything for the help you are receiving, except to 
> 
> give your own time in return to help others. We are all volunteers here, 
> 
> and nobody is going to force you to volunteer in return, but if everyone 
> 
> only received threads that they initiated, nobody would see new threads 
> 
> and nobody would get any answers at all.
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven

You are right, i will set to receive them all.

But i dont know what to do about the thing you say that i double post.

I use google groups i dont intentionally post to python-list too.

How can i avoid that and just only post to python google group?

[toc] | [prev] | [next] | [standalone]


#29345

FromDave Angel <d@davea.name>
Date2012-09-16 15:31 -0400
Message-ID<mailman.812.1347823908.27098.python-list@python.org>
In reply to#29304
On 09/16/2012 07:56 AM, Νικόλαος Κούρας wrote:
> Τη Κυριακή, 16 Σεπτεμβρίου 2012 2:34:34 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε:
>> <snip>
>>
>> No. That's not how mailing lists work. Every email gets posted to all 
>> members, unless they go onto "No Mail", in which case they get no emails 
>> at all.
>>
>> You are not paying anything for the help you are receiving, except to 
>> give your own time in return to help others. We are all volunteers here, 
>> and nobody is going to force you to volunteer in return, but if everyone 
>> only received threads that they initiated, nobody would see new threads 
>> and nobody would get any answers at all.
>>
>>
>> You are right, i will set to receive them all.
>>
>> But i dont know what to do about the thing you say that i double post.
>> I use google groups i dont intentionally post to python-list too.
>> How can i avoid that and just only post to python google group?

Once you get the emails from the official mailing list, posting a reply
is straightforward.  Do a reply-all for most messages, perhaps deleting
some of the to or cc addresses depending on a specific message.  Then
trim the parts you're not responding to, and put your new remarks after
the context you are responding to.  It won't double-post.

For new messages, simply address a new message to python-list@python.org

Depending on your mail reader, you can see the messages in threads,
except for all the people who bust up the threads.  When you get to that
point, post a new thread specifying your email program and OS, and
somebody will probably volunteer to help you get it customized (though
perhaps the actual discussion for that would be offline).

For anybody else listening, the way I avoid seeing the google-groups
double-post is to automatically delete any message that's got a cc to
google-groups.  That way I only get the OTHER copy of the message.



-- 

DaveA

[toc] | [prev] | [next] | [standalone]


#29306 — Obnoxious postings from Google Groups (was: datetime issue)

FromBen Finney <ben+python@benfinney.id.au>
Date2012-09-16 23:18 +1000
SubjectObnoxious postings from Google Groups (was: datetime issue)
Message-ID<87wqzum7h6.fsf_-_@benfinney.id.au>
In reply to#29298
Νικόλαος Κούρας <nikos.gr33k@gmail.com> writes:

> Iam sorry i didnt do that on purpose and i dont know how this is done.
>
> Iam positng via google groups using chrome, thats all i know.

It is becoming quite clear that some change has happened recently to
Google Groups that makes posts coming from there rather more obnoxious
than before. And there doesn't seem to be much its users can do except
use something else.

Using Google Groups for posting to Usenet has been a bad idea for a long
time, but now it just seems to be a sure recipe for annoying the rest of
us. Again, not something you have much control over, except to stop
using Google Groups.

-- 
 \      “Actually I made up the term “object-oriented”, and I can tell |
  `\            you I did not have C++ in mind.” —Alan Kay, creator of |
_o__)                                        Smalltalk, at OOPSLA 1997 |
Ben Finney

[toc] | [prev] | [next] | [standalone]


Page 1 of 7  [1] 2 3 4 5 6 7  Next page →

Back to top | Article view | comp.lang.python


csiph-web