Format from ticks to date

前端 未结 2 1154
故里飘歌
故里飘歌 2020-12-10 14:04

I am needing to transfer some logs which were timestamped in ticks to an XML document. I would prefer the timestamps to be more Specific such as \"July 14, 2009 10:18:04 pm\

相关标签:
2条回答
  • 2020-12-10 14:46

    Assuming 'logText' is the ticks, try:

    DateTime logDate = new DateTime(logText);
    
    0 讨论(0)
  • 2020-12-10 14:57

    If logText is a string, you can convert it to long (Int64) and use this constructor:

    DateTime date = new DateTime(long.Parse(logText));
    
    0 讨论(0)
提交回复
热议问题