Re: Problems of Different Time Zones on Applications (358 Views)
Reply
Regular Advisor
ericfjchen
Posts: 221
Registered: ‎06-15-2004
Message 1 of 9 (358 Views)
Accepted Solution

Problems of Different Time Zones on Applications

Because we plan to establish manufacture sites in the different time zones (only one data center in the world),

we would like to refer to your practice of different time zones on applications.

Please kindly tell us how you resolved the following issues.

For example, if the server time zone corresponds to New York (GMT-5) and the client time zone corresponds to

San Francisco (GMT-8), the client finished a transaction on the data center web system at local time (12-Jun-2008 15:30:45)
then what value stored in the database?

1. server time as “12-Jun-2008 18:30:45”

2. client time with time zone as “12-Jun-2008 15:30:45 GMT-5”

3. others?

And what time will be displayed to the user?

1. server time as “12-Jun-2008 18:30:45”

2. server time with time zone as “12-Jun-2008 18:30:45 GMT-5”

3. client time as “12-Jun-2008 15:30:45”

4. client time with time zone as “12-Jun-2008 15:30:45 GMT-8”

5. others?


Thanks for your help.



Acclaimed Contributor
Dennis Handly
Posts: 25,287
Registered: ‎03-06-2006
Message 2 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

>we would like to refer to your practice of different time zones on applications.

There is only one time, UTC or time_t.
Local times should be converted to UTC and then stored in the database. If you want to display the time, use ctime(3) and each locale would export different values of TZ.

>what value stored in the database?
>3. others?

Yes, UTC. 12-Jun-2008 22:30:45

>And what time will be displayed to the user?
>4. client time with time zone as "12-Jun-2008 15:30:45 GMT-8"

Yes since users are chauvinistic but with a zone, PDT.
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 3 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

Shalom,

In such circumstances we use Greenwich Mean time.

Understand that time in Unix is really the number of seconds since Jan 1, 1970.

Time zone is merely a display format that will not bother most normally written applications.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Regular Advisor
ericfjchen
Posts: 221
Registered: ‎06-15-2004
Message 4 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

Dear All,

Is there any other exception?

Thanks

Eric
Regular Advisor
ericfjchen
Posts: 221
Registered: ‎06-15-2004
Message 5 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

Hi Dennis,

>what value stored in the database?
>3. others?

Yes, UTC. 12-Jun-2008 22:30:45

--> It should be 12-Jun-2008 23:30:45 GMT ?

Acclaimed Contributor
Dennis Handly
Posts: 25,287
Registered: ‎03-06-2006
Message 6 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

>ME: Yes, UTC. 12-Jun-2008 22:30:45

>It should be 12-Jun-2008 23:30:45 GMT?

Are you commenting about the missing "GMT"?
No, UTC is the official term.
$ date -u
Thu Jun 26 04:13:51 UTC 2008

If you are pointing out 22:30 vs 23:30, then I think I'm right. The local time here in the San Jose Bay Area is now:
$ date; date -u
Wed Jun 25 21:18:17 PDT 2008
Thu Jun 26 04:18:17 UTC 2008

Since it is PDT, UTC is only 7 hours more advanced.

>4. client time with time zone as 12-Jun-2008 15:30:45 GMT-8

This seems like that bogus Microsoft way of doing things. I.e. the timezone is normally UTC-8. But during DST, it is -7.
This is expressed on UNIX as PST8PDT. And times are printed as PST or PDT.

(Note San Francisco is that small town north of San Jose. ;-)
Regular Advisor
ericfjchen
Posts: 221
Registered: ‎06-15-2004
Message 7 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

Hi Dennis,

Thanks a lot. Does your application provide a profile which every user can config his/her local time zone?

BTW, may I contact you via email?
If convenient, pls mail to ericfjchen@gmail.com
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 8 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

HP-UX (or any POSIX-compliant unix-like OS) provides a mechanism that allows any user to change his/her timezone preference. It is the TZ environment variable.

In HP-UX, the system startup and login scripts initialize the TZ variable to a value specified in /etc/TIMEZONE. But this is just the system default (i.e. what the system services like cron and sendmail use in their logging).

Any user can modify the TZ environment variable for his/her session if necessary. The user can even run several programs using different timezones.

If you're using an X Window System, try these commands:
TZ=PST8PDT xclock &
TZ=EST5EDT xclock &
TZ=UTC0 xclock &

You now should have three xclocks telling you the time in three different timezones - with no options specified to the xclock command. Only the TZ environment variable was changed.
You can do this to any program which cares about time.

MK
MK
Acclaimed Contributor
Dennis Handly
Posts: 25,287
Registered: ‎03-06-2006
Message 9 of 9 (358 Views)

Re: Problems of Different Time Zones on Applications

>Does your application provide a profile which every user can config his/her local time zone?

Well, I just use the standard UNIX TZ variable as MK explained.
(I don't have a specific application, nor do I use a database. But the compiler does store date info in object files.)

>may I contact you via email?

Unless you have something private, why not continue here.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.