62,046
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 时间戳转换成日期
/// </summary>
/// <param name="unixTimeStamp">时间戳(秒)</param>
/// <returns></returns>
public static DateTime UnixTimestampToDateTime(this DateTime target, long timestamp)
{
var start = new DateTime(1970, 1, 1, 0, 0, 0, target.Kind);
return start.AddSeconds(timestamp);
}