Skip to content

Instantly share code, notes, and snippets.

@farithadnan
Created March 18, 2024 02:06
Show Gist options
  • Save farithadnan/5a7a0d0a2cc5460b526fbef62b957c69 to your computer and use it in GitHub Desktop.
Save farithadnan/5a7a0d0a2cc5460b526fbef62b957c69 to your computer and use it in GitHub Desktop.
Get a current datetime for Kuala Lumpur (Malaysia)
namespace test_datetime
{
internal class Program
{
private static TimeZoneInfo Kuala_Lumpur_Standard_Time = TimeZoneInfo.FindSystemTimeZoneById("Singapore Standard Time");
static void Main(string[] args)
{
DateTime datetime_kuala_lumpur = TimeZoneInfo.ConvertTime(DateTime.UtcNow, Kuala_Lumpur_Standard_Time);
Console.WriteLine("Kuala Lumpur Now: " + datetime_kuala_lumpur);
Console.WriteLine("Kuala Lumpur + 1 Hour: " + datetime_kuala_lumpur.AddHours(1));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment