我有像“1536476400000”这样的json字符串,我使用C#转换成“yyyy-MM-dd”格式。请帮我
2 回答
噜噜哒
TA贡献1784条经验 获得超7个赞
已解决的答案是...
String offset = "1536476400000";
double spotQuoteEffDate = double.Parse(offset );
TimeSpan spotQuoteEffDateTime = TimeSpan.FromMilliseconds(spotQuoteEffDate);
DateTime spotQuote = new DateTime(1970, 1, 1) + spotQuoteEffDateTime;
输出是...
spotQuote = 9/9/2018 7:00:00 AM
万千封印
TA贡献1891条经验 获得超3个赞
请参考下面的代码,
TimeSpan s = TimeSpan.FromMilliseconds(double.Parse("1536476400000" ));
DateTime dt = new DateTime(1970, 1, 1) + s;
Console.writeline(String.Format("{0:yyyy-MM-dd}",dt));
- 2 回答
- 0 关注
- 197 浏览
添加回答
举报
0/150
提交
取消