datetime conversion

rangerbud249

Active member
Joined
Aug 18, 2004
Messages
27
Programming Experience
Beginner
Does any one know how I can convert a time in UTC to Central Standard Time?

Any help is appreciated

Jose
 
You got my curosity up so this is what I came up with:
VB.NET:
 Dim d As TimeZone = TimeZone.CurrentTimeZone
 		Dim dtdaylight As TimeSpan = New TimeSpan(5, 0, 0)
 		Dim dtNotdaylight As TimeSpan = New TimeSpan(6, 0, 0)
 		Try
 			If d.IsDaylightSavingTime(Date.Now) = True Then
 			    MessageBox.Show(CStr(Date.UtcNow), "UTC")
 			    MessageBox.Show(CStr(Date.UtcNow.Subtract(dtdaylight)), "NOW")
 			Else
 			    MessageBox.Show(CStr(Date.UtcNow), "UTC")
 			    MessageBox.Show(CStr(Date.UtcNow.Subtract(dtNotdaylight)), "NOW")
 			End If
 		Catch ex As Exception
 			MessageBox.Show(ex.ToString)
 			MessageBox.Show(ex.StackTrace.ToString)
 			MessageBox.Show(ex.InnerException.ToString)
 		End Try

I am assuming that you are in the Central Time Zone for this example to work. I hope it points you in hte right direction.
 
Back
Top