Convert from epoch to human-readable date

What is epoch time? The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z).

C# Program to Convert EPOCH time to Humna Readable.

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
  public static void Main()
  {
    
    Console.WriteLine(epoch2string(1668513379));
  }
  static string epoch2string(int epoch) 
  {
      return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddHours(5).AddMinutes(30).AddSeconds(epoch).ToString("dd-MM-yyyy hh:mm:ss"); 
  }
}

For information

Reference below link

Epoch Converter – Unix Timestamp Converter

 

 

Spread the love

Similar Posts