Answers for "convert date and time in datetime c#"

C#
4

convert timestamp to datetime c# code

public static DateTime UnixTimeStampToDateTime( double unixTimeStamp )
{
    // Unix timestamp is seconds past epoch
    System.DateTime dtDateTime = new DateTime(1970,1,1,0,0,0,0,System.DateTimeKind.Utc);
    dtDateTime = dtDateTime.AddSeconds( unixTimeStamp ).ToLocalTime();
    return dtDateTime;
}
Posted by: Guest on February-19-2020
0

convert string to date in c#

DateTime convertedDate = DateTime.Parse(Date.ToString("yyyy-MM-dd"));
Posted by: Guest on September-29-2021

Code answers related to "convert date and time in datetime c#"

C# Answers by Framework

Browse Popular Code Answers by Language