Skip to content

Instantly share code, notes, and snippets.

@steentottrup
Last active December 22, 2016 07:20
Show Gist options
  • Save steentottrup/772f7221788556313fa4fca036ac9133 to your computer and use it in GitHub Desktop.
Save steentottrup/772f7221788556313fa4fca036ac9133 to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
namespace ConsoleApplication3 {
class Program {
static void Main(string[] args) {
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
Thread.CurrentThread.CurrentTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time");
DateTime postedDk = new DateTime(2016, 12, 17, 6, 28, 0, DateTimeKind.Local);
Console.WriteLine($"Posted by me, in Denmark, at {postedDk.ToLongDateString()} {postedDk.ToLongTimeString()} local time");
Console.WriteLine($"And displays as {Thread.CurrentThread.CurrentTimeZone.DisplayName} time: {postedDk.ToLongDateString(Thread.CurrentThread.CurrentTimeZone)} {postedDk.ToLongTimeString(Thread.CurrentThread.CurrentTimeZone)}");
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment