Help! Python to compare dates in diff. timezones

rmschne oooooo at beeb.net
Sun Jul 28 15:04:52 EDT 2002


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.

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.

Doing steps 1-4 enables a program in step 5 to work.

rms

Sunit Joshi wrote:
> Hello All
> 
> I have problem which is like this: 
> I have two sites A & B which are in diff. countries in diff.
> timezones.
> Now both sites have same drawings (Microstation files with same names)
> whose revision dates (as integer since epoch) are stored in a table in
> database at both sites. The database structure is same on both sites
> with identical table names.
> 
> Now since the sites are different timezones, I was wondering what
> would be the best way to compare drawings, using Python, that have
> changed between two sites; for e.g. if site A wants to gets a list of
> all models that have changed at site A.
> 
> I'm open to any suggestion like using a query over HTTP, using XML,
> etc.
> 
> thanks
> Sunit
> sunitjoshi at netzero.net





More information about the Python-list mailing list