Compare file times across TimeZones ?

S

Sunit Joshi

Hello All

I'm trying to figure out how to do this the best way. Basically, I
need to compare DateTime of files across TimeZones. The situation is
like this:

1. I have a database say in Korea in which file-1 resides (in OS) and
I have stored the UTC of the file's modified time in the database.

2. Next I create a zip archive and send the file to US, where it's
unzipped as file-2 (but with same name) and the TimeZone info. is lost
since WinZip does not preserve that.

3. Now I also restore the same database in US which has file-1 UTC in
it.

So how do I compare the DateTime of file-2 with the DateTime in the
database ??
Do I convert the file-2 to UTC and then compare it, or do I need to do
this in the same TimeZone as file-1's; i.e Korean ??


thanks
Sunit
 
M

Michael C

Are you storing the time IN the database, or are you using the
date/timestamp on the file itself?

Michael C.
 
M

Michael C

Sunit Joshi said:
The file datatime is stored as UTC in the database.

If the file datetime for file-1 is stored as UTC in the database, then you
just need to convert the datetime of file-2 to UTC and compare. If you
decide to go with comparing them in Korean time, you'll need to do TWO
conversions - convert file-1 datetime from UTC to Korean time zone AND
convert file-2 datetime to Korean time zone. Since you're already using UTC
on one file, it's half the work to convert the datetime on one file. Either
way, make sure they're converted to the same time zone when you compare.

Michael C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top