Date.ToUTC (gb.util)

Static Function ToUTC ( Date As Date ) As Date

Move a date so that its local representation after the move is its UTC representation before the move.

For example, if Date is a timestamp that is July 19, 2005, 00:00:00 in UTC, then the function will return a shifted timestamp that will be July 19, 2005, 00:00:00 in your local timezone.

Example

' How to display the UTC representation of a french date
Use "gb.util"
Dim dNow As Date = Now
Print Format$(dNow, "yyyy-mm-dd hh:nn:ss")
Print Format$(Date.ToUTC(dNow), "yyyy-mm-dd hh:nn:ss")
Print CStr(dNow)
2019-07-13 15:54:17
2019-07-13 13:54:17
07/13/2019 13:54:17.024

See also