Link : https://coderseditor.com/
using System;
public class Program
{
public static void Main()
{
Console.WriteLine(DateTime.Now.ToString());
long time = DateTimeOffset.Now.ToUnixTimeSeconds();
Console.WriteLine(time.ToString());
// Unix timestamp is seconds past epoch
DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
dtDateTime = dtDateTime.AddSeconds(time).ToLocalTime();
Console.WriteLine(dtDateTime.ToString());
}
}
0 Nhận xét