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 13 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 7 of 7 — ← Prev page 1 2 3 4 5 6 [7]


#32578

Fromrurpy@yahoo.com
Date2012-11-01 15:28 -0700
Message-ID<f5083970-f845-4b9c-9ecf-6b6d3b312233@googlegroups.com>
In reply to#32558
On 11/01/2012 06:09 AM, Grant Edwards wrote:> On 2012-10-31, rurpy@yahoo.com <rurpy@yahoo.com> wrote:
>> On 10/31/2012 09:11 AM, Grant Edwards wrote:> On 2012-09-16, ???????? ?????? <nikos.gr33k@gmail.com> wrote:
>>> 
>>>> Iam positng via google groups using chrome, thats all i know.
>>> 
>>> Learn something else.  Google Groups is seriously and permanently
>>> broken, and all posts from Google Groups are filtered out and ignored
>>> by many people (including myself -- I only saw this because somebody
>>> else replied to it).
>>
>> Feel free to filter whatever you want but be aware than in 
>> doing so you risk missing information that could help you
>> avoid disseminating erroneous info.  Of course, carrying out
>> some kind of private war against Google Groups may be more
>> important to you than that... 
> 
> Based on past experience, the chances of useful information being
> posted via Google Groups is very small.  The benefit of avoiding all
> the spam and garbage the comes from that source is more than worth the
> small risk of missing something worthwhile.
> 
> Note that I'm _not_ talking about people posting to the mailing list
> using Gmail -- only people posting via the Google Groups web UI.

Your experience is that most GG posts are junk but not 
most Gmail posts.  And yet someone else posted that Gmail 
posts are the junk ones.  So I wonder how accurate these 
evaluations are.

In either case, while there has been some spam and garbage
posts in c.l.p in the past, I haven't seen very many lately.  
And even in the past, they seemed pretty recognizable to me 
and easily skipped over.

As for stupid questions, undesired formatting etc, I seldom
look at the message headers so I never noticed whether they 
are mostly from GG or Gmail.  But then again I never found 
it hard to glance at a post and move on if I didn't want to 
read it.  YMMV.

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


#29308

From"Günther Dietrich" <gd.usenet@spamfence.net>
Date2012-09-16 15:22 +0200
Message-ID<gd.usenet-8098E5.15221116092012@dwarf.main.lan>
In reply to#29295
In article <cdf072b2-7359-4417-b1e4-d984e4317091@googlegroups.com>,
 Νικόλαος Κούρας <nikos.gr33k@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@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?

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


#29321

Frompandora.koura@gmail.com
Date2012-09-16 08:43 -0700
Message-ID<d6a38619-af14-4265-a13e-a44ccd80babe@googlegroups.com>
In reply to#29308
Τη Κυριακή, 16 Σεπτεμβρίου 2012 4:23:02 μ.μ. UTC+3, ο χρήστης Günther Dietrich έγραψε:
> In article <cdf072b2-7359-4417-b1e4-d984e4317091@googlegroups.com>,
> 
>  Νικόλαος Κούρας <nikos.gr33k@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@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.

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


#29346

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-09-16 15:35 -0400
Message-ID<mailman.813.1347824120.27098.python-list@python.org>
In reply to#29321
On Sun, 16 Sep 2012 08:43:14 -0700 (PDT), pandora.koura@gmail.com
declaimed the following in gmane.comp.python.general:

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

	I presume you are able to install your own Python scripts, or you
wouldn't even be able to try the import.

	So far as I can see, pytz is a pure Python package -- no binaries...
You should be able to extract it onto your local development machine,
then copy the entire pytz system from your site-packages to whereever
you install your Python scripts. You might have to tweak (from inside
your script) the pythonpath before doing the import, but it should be
doable.

	If not, then I suggest you study the Python Library reference
section for the datetime module -- in particular the part about using
the tzinfo class, and implement just enough to do your time translation.
Most of pytz is just an implementation of the tzinfo class along with a
database of recognized world timezones and offsets.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#29315

FromMRAB <python@mrabarnett.plus.com>
Date2012-09-16 16:27 +0100
Message-ID<mailman.793.1347809414.27098.python-list@python.org>
In reply to#29295
On 2012-09-16 09:25, Νικόλαος Κούρας wrote:
[snip]
>
> 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.
>
In programming, you need attention to details.

My reply didn't use datetime.datetime.now(), it used 
datetime.datetime.utcnow().

datetime.datetime.now() gives the local time (local to the system on 
which it is running).

datetime.datetime.utcnow() gives the UTC (GMT) time, which is the same 
everywhere.

The line should be this:

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

I've also used '%Y' instead of '%y' because I prefer 4 digits for the year.

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


#29317

Frompandora.koura@gmail.com
Date2012-09-16 08:40 -0700
Message-ID<5680604e-98e5-48c1-b5ac-9b837bc16770@googlegroups.com>
In reply to#29315
Τη Κυριακή, 16 Σεπτεμβρίου 2012 6:30:15 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:
> On 2012-09-16 09:25, Νικόλαος Κούρας wrote:
> 
> [snip]
> 
> >
> 
> > 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.
> 
> >
> 
> In programming, you need attention to details.
> 
> 
> 
> My reply didn't use datetime.datetime.now(), it used 
> 
> datetime.datetime.utcnow().
> 
> 
> 
> datetime.datetime.now() gives the local time (local to the system on 
> 
> which it is running).
> 
> 
> 
> datetime.datetime.utcnow() gives the UTC (GMT) time, which is the same 
> 
> everywhere.
> 
> 
> 
> The line should be this:
> 
> 
> 
> date = (datetime.datetime.utcnow() + datetime.timedelta(hours=8) 
> 
> ).strftime('%Y-%m-%d %H:%M:%S')
> 
> 
> 
> I've also used '%Y' instead of '%y' because I prefer 4 digits for the year.

Cant it be written more easily as:
 date = (datetime.datetime.utcnow(+2)

i know this is not thhe correct syntax but it just needs a way to add GMT+2 hours since utc=gmt

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


#29323

FromChris Angelico <rosuav@gmail.com>
Date2012-09-17 01:54 +1000
Message-ID<mailman.798.1347810852.27098.python-list@python.org>
In reply to#29317
On Mon, Sep 17, 2012 at 1:40 AM,  <pandora.koura@gmail.com> wrote:
> Cant it be written more easily as:
>  date = (datetime.datetime.utcnow(+2)
>
> i know this is not thhe correct syntax but it just needs a way to add GMT+2 hours since utc=gmt

I've dithered about whether to open this can of worms or let sleeping
dogs lie, and I finally decided to make some metaphor potpourri.

Simple UTC offsets are not the same thing as local time. There are a
variety of other considerations, but the main one is Daylight Robbery
Time, where every government wants to put its own stamp on things by
fiddling with the DST rules a bit. Most places will move their clocks
an hour forward for summer and then back for winter. But!

* Some places are sensible and don't have DST at all (eg
Australia/Queensland, America/Arizona)
* Northern hemisphere summer corresponds to southern hemisphere
winter, and vice versa
* Everyone has a different way of defining the boundaries of summer and winter
* And just to confuse us all, Irish Standard Time is used in summer,
and they *subtract* an hour for winter time!

The only way to handle timezones correctly and keep yourself even
marginally sane is to hand the job on to somebody else. I dodged the
whole issue by letting our Postgres database handle everything for us
(date/time formats, timezones, the lot), and having our internal
systems all just work in UTC. You'll likely find it easiest to do the
same thing with a Python library.

Just don't try to pretend to yourself that Greece uses GMT+2, because
it's not that simple. For one thing, it's currently summer there...

ChrisA

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


#29343

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-09-16 20:23 +0100
Message-ID<mailman.810.1347823432.27098.python-list@python.org>
In reply to#29317
On 16/09/2012 16:54, Chris Angelico wrote:
> On Mon, Sep 17, 2012 at 1:40 AM,  <pandora.koura@gmail.com> wrote:
>> Cant it be written more easily as:
>>   date = (datetime.datetime.utcnow(+2)
>>
>> i know this is not thhe correct syntax but it just needs a way to add GMT+2 hours since utc=gmt
>
> I've dithered about whether to open this can of worms or let sleeping
> dogs lie, and I finally decided to make some metaphor potpourri.
>
> Simple UTC offsets are not the same thing as local time. There are a
> variety of other considerations, but the main one is Daylight Robbery
> Time, where every government wants to put its own stamp on things by
> fiddling with the DST rules a bit. Most places will move their clocks
> an hour forward for summer and then back for winter. But!
>
> * Some places are sensible and don't have DST at all (eg
> Australia/Queensland, America/Arizona)
> * Northern hemisphere summer corresponds to southern hemisphere
> winter, and vice versa
> * Everyone has a different way of defining the boundaries of summer and winter
> * And just to confuse us all, Irish Standard Time is used in summer,
> and they *subtract* an hour for winter time!
>
> The only way to handle timezones correctly and keep yourself even
> marginally sane is to hand the job on to somebody else. I dodged the
> whole issue by letting our Postgres database handle everything for us
> (date/time formats, timezones, the lot), and having our internal
> systems all just work in UTC. You'll likely find it easiest to do the
> same thing with a Python library.
>
> Just don't try to pretend to yourself that Greece uses GMT+2, because
> it's not that simple. For one thing, it's currently summer there...
>
> ChrisA
>

I guess that Double British Summer Time made things twice as difficult?

-- 
Cheers.

Mark Lawrence.

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


#29318

Frompandora.koura@gmail.com
Date2012-09-16 08:40 -0700
Message-ID<mailman.795.1347810046.27098.python-list@python.org>
In reply to#29315
Τη Κυριακή, 16 Σεπτεμβρίου 2012 6:30:15 μ.μ. UTC+3, ο χρήστης MRAB έγραψε:
> On 2012-09-16 09:25, Νικόλαος Κούρας wrote:
> 
> [snip]
> 
> >
> 
> > 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.
> 
> >
> 
> In programming, you need attention to details.
> 
> 
> 
> My reply didn't use datetime.datetime.now(), it used 
> 
> datetime.datetime.utcnow().
> 
> 
> 
> datetime.datetime.now() gives the local time (local to the system on 
> 
> which it is running).
> 
> 
> 
> datetime.datetime.utcnow() gives the UTC (GMT) time, which is the same 
> 
> everywhere.
> 
> 
> 
> The line should be this:
> 
> 
> 
> date = (datetime.datetime.utcnow() + datetime.timedelta(hours=8) 
> 
> ).strftime('%Y-%m-%d %H:%M:%S')
> 
> 
> 
> I've also used '%Y' instead of '%y' because I prefer 4 digits for the year.

Cant it be written more easily as:
 date = (datetime.datetime.utcnow(+2)

i know this is not thhe correct syntax but it just needs a way to add GMT+2 hours since utc=gmt

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


#29348

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-09-16 15:37 -0400
Message-ID<mailman.814.1347824402.27098.python-list@python.org>
In reply to#29295
On Sun, 16 Sep 2012 16:27:16 +0100, MRAB <python@mrabarnett.plus.com>
declaimed the following in gmane.comp.python.general:


> The line should be this:
> 
> date = (datetime.datetime.utcnow() + datetime.timedelta(hours=8) 
> ).strftime('%Y-%m-%d %H:%M:%S')
>
	I think "hours = 2"... UTC to Athens is two hours... the OP was
trying 8 hours to get from US Central to Greece (and not accounting for
possible daylight savings times)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#29296

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-16 01:25 -0700
Message-ID<mailman.787.1347783937.27098.python-list@python.org>
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]


#29281

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 22:15 -0700
Message-ID<mailman.780.1347773064.27098.python-list@python.org>
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]


#29274

FromΝικόλαος Κούρας <nikos.gr33k@gmail.com>
Date2012-09-15 12:26 -0700
Message-ID<mailman.775.1347737215.27098.python-list@python.org>
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] | [standalone]


Page 7 of 7 — ← Prev page 1 2 3 4 5 6 [7]

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


csiph-web