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


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

datetime question

Started byΝίκος Αλεξόπουλος <nikos.gr33k@gmail.com>
First post2013-11-08 23:11 +0200
Last post2013-11-12 19:20 +0000
Articles 6 on this page of 66 — 21 participants

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


Contents

  datetime question Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-11-08 23:11 +0200
    Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-08 21:29 +0000
      Re: datetime question Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-11-09 00:01 +0200
        Re: datetime question Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-08 17:06 -0500
          Re: datetime question rurpy@yahoo.com - 2013-11-11 14:49 -0800
            Re: datetime question Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-11 18:18 -0500
        Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-08 22:18 +0000
        Re: datetime question Grant Edwards <invalid@invalid.invalid> - 2013-11-08 22:29 +0000
          Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-09 09:39 +1100
            Re: datetime question Roy Smith <roy@panix.com> - 2013-11-09 10:30 -0500
          Re: datetime question Gene Heskett <gheskett@wdtv.com> - 2013-11-09 10:39 -0500
          Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-10 09:25 +1100
        Re: datetime question Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-08 22:49 +0000
          Re: datetime question Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-11-09 01:02 +0200
            Re: datetime question Robert Kern <robert.kern@gmail.com> - 2013-11-08 23:23 +0000
            Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-09 10:30 +1100
            Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-09 00:12 +0000
            Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-09 12:45 +0000
              Re: datetime question Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-11-09 15:43 +0200
                Re: datetime question unknown <unknown@unknown.com> - 2013-11-10 12:52 +0000
            Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-09 23:52 +1100
    Re: datetime question Gene Heskett <gheskett@wdtv.com> - 2013-11-09 19:55 -0500
    Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-10 19:47 +1100
    Re: datetime question Gene Heskett <gheskett@wdtv.com> - 2013-11-10 04:13 -0500
    Re: datetime question Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-11-11 11:57 +0200
      Re: datetime question Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-11 08:41 -0500
        Re: datetime question Roy Smith <roy@panix.com> - 2013-11-11 09:14 -0500
          Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-12 01:25 +1100
          Re: datetime question Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-11 09:36 -0500
          Re: datetime question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-11 20:59 -0500
          Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-12 13:02 +1100
          Re: datetime question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-11 21:02 -0500
          Re: datetime question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-12 19:30 -0500
          Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-13 11:40 +1100
      Re: datetime question Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-11 19:19 +0000
        Re: datetime question Ethan Furman <ethan@stoneleaf.us> - 2013-11-11 11:39 -0800
          Re: datetime question Grant Edwards <invalid@invalid.invalid> - 2013-11-11 20:45 +0000
          Re: datetime question mm0fmf <none@mailinator.com> - 2013-11-11 23:21 +0000
            Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-11 23:48 +0000
              Re: datetime question Grant Edwards <invalid@invalid.invalid> - 2013-11-12 04:49 +0000
                Re: datetime question alex23 <wuwei23@gmail.com> - 2013-11-12 17:25 +1000
                  Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-12 18:35 +1100
                  Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-12 09:20 +0000
                Re: datetime question Roy Smith <roy@panix.com> - 2013-11-12 09:18 -0500
    Re: datetime question Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-11-12 12:15 +0200
      Re: datetime question Andy Lawton <andy@andylawton.eu> - 2013-11-12 12:47 +0000
        Re: datetime question Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-11-12 15:32 +0200
          Re: datetime question Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-12 09:03 -0500
            Re: datetime question Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-11-12 16:12 +0200
              Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-13 01:57 +1100
                Re: datetime question Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-11-12 17:24 +0200
                  Re: datetime question Tim Chase <python.list@tim.thechases.com> - 2013-11-12 09:54 -0600
                    Re: datetime question Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-11-12 17:57 +0200
                      Re: datetime question Tim Chase <python.list@tim.thechases.com> - 2013-11-12 10:12 -0600
                      Re: datetime question William Ray Wing <wrw@mac.com> - 2013-11-12 11:14 -0500
                      Re: datetime question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-12 16:30 +0000
                      Re: datetime question MRAB <python@mrabarnett.plus.com> - 2013-11-12 19:09 +0000
                      Re: datetime question Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-12 14:14 -0500
                      Re: datetime question Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-12 19:24 +0000
                        Re: datetime question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-12 19:38 -0500
                      Re: datetime question Chris Angelico <rosuav@gmail.com> - 2013-11-13 09:42 +1100
                      Re: datetime question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-12 19:37 -0500
                      Re: datetime question MRAB <python@mrabarnett.plus.com> - 2013-11-13 01:08 +0000
                    Re: datetime question Alister <alister.ware@ntlworld.com> - 2013-11-12 16:11 +0000
                      Re: datetime question Roy Smith <roy@panix.com> - 2013-11-12 19:43 -0500
        Re: datetime question Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-12 19:20 +0000

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


#59241

FromChris Angelico <rosuav@gmail.com>
Date2013-11-13 09:42 +1100
Message-ID<mailman.2492.1384296162.18130.python-list@python.org>
In reply to#59212
On Wed, Nov 13, 2013 at 6:14 AM, Joel Goldstick
<joel.goldstick@gmail.com> wrote:
> In the US, the state of Indiana is really weird.  Three separate time
> zone areas, that don't all flip in the same way.  See this for TZ
> hell:  http://en.wikipedia.org/wiki/Indiana_time_zones

Timezones are one of the most interesting [1] things in the world.
Ireland doesn't move clocks forward for summer time, they move them
backward for winter time... I swear, when I first heard that, I
thought it was just one of those Irish jokes with no basis, but it is
true...

https://en.wikipedia.org/wiki/Time_in_the_Republic_of_Ireland

Plus, they switch clocks at 2am all the time, not at 2am forward and
3am backward.

ChrisA

[1] Define "interesting".
http://www.imdb.com/title/tt0379786/quotes?item=qt0433039

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


#59265

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-11-12 19:37 -0500
Message-ID<mailman.2512.1384303063.18130.python-list@python.org>
In reply to#59212
On Wed, 13 Nov 2013 09:42:38 +1100, Chris Angelico <rosuav@gmail.com>
declaimed the following:

>
>Plus, they switch clocks at 2am all the time, not at 2am forward and
>3am backward.
>
	2AM is the time at which US switches occur also, in either direction.

	Unfortunately, my radio controlled clocks tend to synchronize between 1
and 2 AM, and those that automatically do daylight vs normal switching
(three Oregon Scientific) miss the broadcast of the change. My watch and a
LaCrosse unit require manual toggling between the two.


	Good thing I don't run a store... I'd annoy my customers by changing
the store hours instead <G>
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#59271

FromMRAB <python@mrabarnett.plus.com>
Date2013-11-13 01:08 +0000
Message-ID<mailman.2516.1384304904.18130.python-list@python.org>
In reply to#59212
On 13/11/2013 00:37, Dennis Lee Bieber wrote:
> On Wed, 13 Nov 2013 09:42:38 +1100, Chris Angelico <rosuav@gmail.com>
> declaimed the following:
>
>>
>>Plus, they switch clocks at 2am all the time, not at 2am forward and
>>3am backward.
>>
> 	2AM is the time at which US switches occur also, in either direction.
>
The difference compared with the EU is that they switch according to
local time, so different US time zones switch at different UTC times.

> 	Unfortunately, my radio controlled clocks tend to synchronize between 1
> and 2 AM, and those that automatically do daylight vs normal switching
> (three Oregon Scientific) miss the broadcast of the change. My watch and a
> LaCrosse unit require manual toggling between the two.
>
>
> 	Good thing I don't run a store... I'd annoy my customers by changing
> the store hours instead <G>
>

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


#59216

FromAlister <alister.ware@ntlworld.com>
Date2013-11-12 16:11 +0000
Message-ID<Eqsgu.53488$F07.39752@fx06.am4>
In reply to#59210
On Tue, 12 Nov 2013 09:54:44 -0600, Tim Chase wrote:

> On 2013-11-12 17:24, Ferrous Cranus wrote:
>> But what of the server was in California and i live in Greece?
>> 
>> How would datetime.now() work then?
> 
> Best practices say to move the value from local time to UTC as soon as
> possible, then store/use the UTC time internally for all operations. 
> Only when it's about to be presented to the user should you convert it
> back to local time if you need to.
> 
> -tkc

& it is probably best converted to local time client side (as has already 
been suggested) you may end up with a situation where the server is in 
the USA & your user is in Portugal.
how i you going to identify the users time zone server side(clue you cant 
at least not reliably).

whatever solution you take it is better written as a function rather than 
a single line of code so it can be re-used, you are almost certainly 
going to want this in more than one place


complicated one-liners may "look cool" to show of your programming skills 
but in the real world they are a maintenance nightmare & are probably 
best avoided.


-- 
The plot was designed in a light vein that somehow became varicose.
		-- David Lardner

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


#59269

FromRoy Smith <roy@panix.com>
Date2013-11-12 19:43 -0500
Message-ID<roy-35E6DA.19434512112013@news.panix.com>
In reply to#59216
In article <Eqsgu.53488$F07.39752@fx06.am4>,
 Alister <alister.ware@ntlworld.com> wrote:

> > Best practices say to move the value from local time to UTC as soon as
> > possible, then store/use the UTC time internally for all operations. 
> > Only when it's about to be presented to the user should you convert it
> > back to local time if you need to.
> > 
> > -tkc
> 
> & it is probably best converted to local time client side (as has already 
> been suggested) you may end up with a situation where the server is in 
> the USA & your user is in Portugal.

Or, your server is in California, your user is in Portugal, and he 
prefers to keep his laptop on New York time.

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


#59230

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2013-11-12 19:20 +0000
Message-ID<l5tv19$io2$1@dont-email.me>
In reply to#59189
On Tue, 12 Nov 2013 12:47:58 +0000, Andy Lawton wrote:

> (I think "Europe/Kiev" is Greece but I don't know)

I suspect Nick is really in a coding sweatshop in "Asia/Mumbai"

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [standalone]


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

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


csiph-web