How Get Current Datetime-1hour In UTC And Convert "yyyy-MM-dd'T'HH:mm:ss.ssZ"

Get UTC Current Date:

UTC->DateTime Type
StringDate->String Type
UTCF String->Type

UTC=TimeZoneInfo.ConvertTimeToUtc(DateTime.Parse(Convert.ToString(Now)))

Current DateTime-1Hour
UTC.AddHours(-1).Tostring(“MM/dd/yyyy HH:mm:ss”)
image

Final Format-> “yyyy-MM-dd’T’HH:mm:ss.ssZ”
System.Datetime.ParseExact(StringDate,“MM/dd/yyyy HH:mm:ss”,New system.Globalization.CultureInfo(“en-US”)).ToString(“yyyy-MM-dd’T’HH:mm:ss.ssZ”)

Code File
UTCTime.xaml (6.4 KB)

1 Like