DateTime Conversion and Parsing DateTime.Now.ToString(“MM/dd/yyyy hh:mm:ss.fff”)

前端 未结 3 909
半阙折子戏
半阙折子戏 2020-12-21 07:41

I store some DateTime in a CSV log with:

DateTime.Now.ToString(\"MM/dd/yyyy hh:mm:ss.fff\")

When I try to read it I found something like:

3条回答
  •  一向
    一向 (楼主)
    2020-12-21 07:58

    You should use this method to parse your string. You would have to make a class, imlementing IFormatProvider, but if you want to use a custom DateTime format, it's the best method I can think of.

提交回复
热议问题