vb.net - convert local time to utc -


I have functions to get the UTC time I Dtuniversal I have the SQL server data type near the stroed proc of time.

It works well for 6 AM Eastern (which is 23 UTC) values, it fails at 7 AM Eastern (which is 24 UTC), I get an error "Invalid value for this metadata".

  Personal Function GETTactTime (TimeTime as Time-Time) TimeTime as a timely DT (timetix) DT = DT. Universal Time () return as DIT Universal New Taimspen (Dititik) DT Universal following function:  

The following test code states that variable time (aTimeSpan) should be seen on.

  Private Sub Button1_Click (ByVal as the System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click as dim ts new time period (DateTime.Now.Ticks ) make a test period 'dim ts new time period (0,0,0) as "as a trial period oneHr dim new timeSpan (1, 0, 0)' int x GetUTCTime Debug.WriteLine 24 ' An hour increment for call to 25 = 0 ("& Amp; Getutctime (ts) .tostring) ts = ts.Add (oneHr) 'add an hour Next end sub personal function gatetake As Time (Taimspen Volt Taimtains) time as "I do not want to use the variable names 23 :: 08.8112022 '733,980.23: 23: 08.81,12,022' 733,981.00 as new Date Time ( aTimeSpan.Ticks) dt = dt.ToUniversalTime () dim dtUniversal new time period (dt.Ticks) return dtUniversal end function 'debug output DT dim keyword as' 733,980.22: 23: 08.8112022 '733,981.01: 23: 08.8112022' 733,981.02: 23 : 08.8112022 '733981.03: 23: 08.8112022' 733981.04: 23: 08.8112022 '7 33981.05: 23: 08.8112022' 733981.07: 23: 08.8112022 '733981.08: 23: 08.8112022' 733981.09: 23: 08.8112022 '733981.10: 23: 08.8112022' 733 981.11: 23: 08.8112022 '733981.12: 23: 08.8112022' 733981.14: 23: 08.8112022 '733981.16: 23: 08.8112022' 733981.17: 23: 08.8112022 '733981.18: 23: 08.8112022' 733981.19: 23: 08.8112022 '733981.20: 23: 08.8112022 '733981.21: 23: 08.8112022' 733981.22: 23: 08.8112022  

If you're just into UTC and back to local:

  ' In the local time, a test date in the form of dim d date time = date time. Now localize to localize UTC, such as time-time = D. To Universal Time 'UTC transform into a local Dim ND = U.O.OolocalTime  

Either you are making it as difficult, or I'm missing something

  Dim D like datetime = date time.parse ("10: 00") 'This is the local central daylight, as is the period from time to time = d. To Universal Time 'This is Universal D = U To local time 'double check  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -