472,958 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Time zones dates in vb.net 2005

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
Jul 13 '07 #1
4 3872
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" <ga*****@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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

Jul 13 '07 #2
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" <ga*****@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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

Jul 13 '07 #3
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*******@freenet.dewrote in message
news:uE**************@TK2MSFTNGP03.phx.gbl...
>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" <ga*****@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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


Jul 13 '07 #4
"Steve" <ga*****@newsgroups.nospamschrieb
Hi Armin

Thanks for the reply

Great explanation
Was a pleasure. :-)
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


Armin

Jul 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Mike A | last post by:
Hi, I'm hoping someone can help me with this. I have a URL for which I'd like to limit access to by time. For example,say I have a URL that I don't want accessable on Monday mornings between...
6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
5
by: Gord | last post by:
Many scripts and calendars call client side system time in order to make presentations. However, the client's time may be improperly set, if set at all, and/or the relevant time may be from...
11
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
14
by: Cesar Ronchese | last post by:
Hello! I've built a program that show some dates to users. I got a problem when users have different configured time zone machines, where: - One machine that determined time zone the date...
15
by: Cesar Ronchese | last post by:
Hi, I built the sample code showing the problem with dates when viewed at different machines, different Time Zones and transported via Remoting. The zip can be downloaded here: ...
3
by: Satish Itty | last post by:
Hi all, I have a big problem in my hands and not sure how I can fix this. Any suggestions would be greatly appreciated. I have a .NET 3 tier app developed in VS2003 and .NET 1.1. the client is a...
6
by: dredge | last post by:
Hi, the server that hosts my PHP pages has its clock set to Greenwich Mean Time (GMT timezone 0). I need for my PHP scripts to have access to my local time which is Central Standard Time in the...
0
amitpatel66
by: amitpatel66 | last post by:
Hi All, Find below some useful information about Time Zone Conversion in oracle. Hope this would be helpful for many of them since all the real time projects that we work in follow different time...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.