Help! Python to compare dates in diff. timezones

Gerhard Häring gerhard.haering at gmx.de
Sun Jul 28 15:25:42 EDT 2002


Just adding some technical tips.

* rmschne <oooooo at beeb.net> [2002-07-28 19:04 +0000]:
> Sunit,
> 
> I would recommend you do the following.
> 
> 1.  confirm the system date each site is running on the relevant machine.
> 2.  confirm the times in the database match what you expect from 1
> 
> (I say steps 1 and 2 above as I was once caught out by what I thought 
> were two different time-zoned machines, but in fact both were set for GMT).
> 
> 3.  along those lines, consider setting both machines to GMT or some 
> common time.
> 
> 4.  Ensure you keep both machines in synch with each other re time, or 
> at least to a common standard.  You recognize that both machines could 
> be set for a different time zone, but you also ought to control the 
> drift that inevitably will occur.

The natural solution is to use NTP here.

> 5.  In your Python script, simply have a variable which records the
> time zone of each site, and then write a function that does the
> arithmetic (adding or subtracting hours) to suit your needs.

mxDateTime would come in useful here.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list