Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
DateTime With TimeZone to UTC DateTime
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string DisplayName = "custom standard name here";//custom Standard Name to display eg: Kathmandu string StandardName = "custom standard name here"; // custom Standard Name eg: Asia/Kathamandu, Nepal string YourDate="27-03-2019 20:24:56"; // this DateTime doesn't contain any timeZone TimeSpan Offset = new TimeSpan(+5, 30, 00);// your TimeZone offset eg: timeZone of Nepal is +5:45 TimeZoneInfo TimeZone = TimeZoneInfo.CreateCustomTimeZone(StandardName, Offset, DisplayName, StandardName); var RawDateTime = DateTime.SpecifyKind(DateTime.Parse(YourDate), DateTimeKind.Unspecified);// I all it RawDateTime Since it doesn't contain any TimeSpan DateTime UTCDateTime = TimeZoneInfo.ConvertTimeToUtc(RawDateTime, TimeZone); Console.WriteLine(UTCDateTime); } } }
run
|
edit
|
history
|
help
0
3D Array
adxsadxcasxsd
asxdf
Swiss Infotech Tutorial
IntToExcelColumnNotation
Order of Ops 4.2
dcsdasxsdcdf
Non-User input - Random Controlled - Guessing Game
ssz
A