Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# convert Unix time in seconds to datetime

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;
}
Comment

c# convert datetime to unix timestamp

Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
Comment

PREVIOUS NEXT
Code Example
Csharp :: create new .net project 
Csharp :: datetimeoffset to datetime c# 
Csharp :: C# default value for datetime parameter 
Csharp :: create list in c# 
Csharp :: github action get commit tag 
Csharp :: wpf color picker 
Csharp :: c# empty list 
Csharp :: public tmpro text 
Csharp :: asp.net textarea disable resize 
Csharp :: c# for statement 
Csharp :: how to know character is a digit or not in c# 
Csharp :: c# convert string array to int array 
Csharp :: wpf resource dictionary 
Csharp :: get tag unity 
Csharp :: c# add button to messagebox 
Csharp :: mvc write to console 
Csharp :: c# merge two xml files 
Csharp :: increase value in dictionary against a key in c# 
Csharp :: datetime month name 
Csharp :: change size of a unity object 
Csharp :: dictionary to list c# 
Csharp :: Show private fields in Unity Inspector 
Csharp :: if set active == false unity 
Csharp :: random mac address c# 
Csharp :: string tochar array c# 
Csharp :: wasd code for unity 
Csharp :: vb.net read text file line by line 
Csharp :: how to close another app in system with c# 
Csharp :: disabling a button if textbox is empty c# 
Csharp :: set text in unity invisible 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =