我尝试使用以下方法将“ 1561282151027”的时间戳(具有13位数字)转换为C#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;
}
如何将13位Unix时间戳转换为C#DateTime?