Get DateTime.Now with milliseconds precision

前端 未结 11 1478
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 16:06

How can I exactly construct a time stamp of actual time with milliseconds precision?

I need something like 16.4.2013 9:48:00:123. Is this possible? I have an applic

11条回答
  •  隐瞒了意图╮
    2020-11-29 16:55

    Use DateTime Structure with milliseconds and format like this:

    string timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", 
    CultureInfo.InvariantCulture);
    timestamp = timestamp.Replace("-", ".");
    

提交回复
热议问题