Re: Time zones dates in vb.net 2005

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Armin

Thanks for the reply

Great explanation

As only the synchronising code uses these dates I have gone with A

I have set the region on 1 computer to 'Perth Australia' and the other is on
'Canberra, Melbourne, Sydney' and it works a treat

Regards
Steve
"Armin Zingler" <az.nospam@xxxxxxxxxx> wrote in message
news:uEG1KbUxHHA.4436@xxxxxxxxxxxxxxxxxxxxxxx
I see three ways to store the information:

a) Store UTC only (one field). It is sufficient but afterwards you won't
know at which local time offset it has been stored. It is not necessary if
you don't want to know it.
b) Store UTC (one field) and local time offset (+10 or whatever) in
another
field.
c) Store local time and local time offset. By subtracting the latter from
the former, you get UTC.


b) and c) are a matter of taste. They contain the same information. I'd
probably go for b). c) is more like what is used in mail headers ("23:17
+1000" is local time + time offset).

Internally, you can always use and calculate with the UTC datetime values.
If you take the current, local date (Datetime.Now) into your calculations,
also convert to UTC before doing the calculations or before storing it in
the DataRow (later Database). Only convert to local time whenever you want
to display the local time, and convert to UTC when converting input to a
DateTime value.

I guess you know that DateTime provides the ToUniversalTime and
ToLocalTime methods.


Armin

Hi All

Further to the above post

The times can change based on the time of year, as not all states in
Australia use daylight saving and those that do don't always change
at the same time

Regards
Steve

"Steve" <ga630sf@xxxxxxxxxxxxxxxxx> wrote in message
news:%23$xdAJSxHHA.1776@xxxxxxxxxxxxxxxxxxxxxxx
Hi All

I need to compare date times from 2 different states in Australia
in a Program I have which determines which way to update SQl
server 2005 tables based on the lastupdate (datetime field)
datetime

Each location updates the lastupdate field based on the current
local datetime at the the time of saving to SQL server

Perth for example is 2 hours behind Melbourne

How is the best way to do this

Convert both times to UTC first?

Regards
Steve






.



Relevant Pages

  • Re: Web services and incorrect handling of time zones in DateTime
    ... You are not the first one writing this, I think that it is an error by design. ... when the SOAP message contains datetime like ... exactly the same time as previously, but in UTC), it becomes DateTime ... the UTC time should be converted to local time ...
    (microsoft.public.dotnet.general)
  • Re: DateTime about the zone
    ... You mean it's 093429 local time in France? ... That means that 073429 is UTC. ... Thanks, fine, seems to be easier to do with Time than with DateTime ...
    (comp.lang.ruby)
  • Re: System.TimeZone interface unusable?
    ... ToLocalTime must be "A DateTime instance whose value is the local time ... as the parameter states "a UTC time". ... serializer documentation is the only other place the Kind property is ...
    (microsoft.public.dotnet.framework)
  • [kde] Re: Datetimes on files from my phone are off by three hours
    ... timezone, as is the computer. ... One reason for this is that UTC doesn't have the ambiguity of "summer" aka ... The other option is to set the hardware clock to local time, ...
    (KDE)
  • Timezone and ISO8601 struggles with datetime and xml.utils.iso8601.parse
    ... I am trying to convert a local time into UTC ISO8601, then parse it ... How can I convert this into UTC? ... the date is converted into UTC on construction of the datetime object, ...
    (comp.lang.python)