Cesar Ronchese said:
I noticed this is like you creating a file in a such machine and
opening the Windows Explorer in other machine configured with
different time zone. The date displayed is according difference of
your location.
For sample:
- create the file at 10:00am in some machine
- choose other machine and set the time zone to +3:00h, for sample -
open Windows Explorer in that second machine and access that first
machine, and see your created file
- see the creation date of that file. Is -3:00h
But I would like not apply this to my application
(
The users can accidentally keep some incorrect configuration on the
machine and the dates can be misviewed, which can occurs in
financial loses if misinterpreted.
Well,
1) Please answer my other question first.
2) I understand you, but in your case, this actually should not happen. We
are already about to find out why different values are displayed.
3) You really must handle this problem because it is often disregarded: If
you display a date/time value, you have to think about in which time zone
you want to display it. You also must think about the time zone if you store
it in a database. Both is important! If you store a value in a database you
should store the UTC value. Example:
If you enter 1/1/2006 05:00 AM on machine #1 in a textbox, which time zone
is it? Usually it is the local time. Let's assume it is +2 hours. Now you
store this value in a database. Machine #2's time zone is +5 hours. On
machine #2, the value is loaded from the database. Now, which value do you
intend to display?
a) machine #1's time zone: "1/1/2006 05:00 AM"
b) UTC: "1/1/2006 03:00 AM"
c) machine #2's time zone: "1/1/2006 08:00 AM"
Version a) is not possible because machine #2 does not know the time zone of
machine #1. Therefore, only b) and c) can be used. Version a) would only be
possible if machine #1's time zone was stored along with the value in the
database. This wouldn't make (a lot) sense because version b) was better.
Now, you must choose between b) and c). That's up to you. As you see in
Windows Explorer, it uses c). What you choose depends on your needs. In any
case, it must be clear which time zone is it. So, if you go with b), you
should display
"1/1/2006 03:00 AM UTC".
Anyway, with the situation you describe, there shouldn't be a difference at
all. So, please see 1).
Armin