BadCat
V2EX  ›  C#

这种格式的时间(文件名)怎么转换成 DateTime?

  •  
  •   BadCat · Aug 27, 2018 · 4242 views
    This topic created in 2819 days ago, the information mentioned may be changed or developed.

    这样的字符串:20170618030000 如何转成这种:2017/06/18/03:00:00 或其他的 DateTime 格式

    http://ww2.sinaimg.cn/large/005IRbZEgy1fuo3twiownj307a00q0si.jpg

    4 replies    2018-10-16 16:46:44 +08:00
    hjc4869
        1
    hjc4869  
       Aug 27, 2018   ❤️ 1
    用 DateTime.ParseExact("20170618030000", "yyyyMMddhhmmss", CultureInfo.InvarientCulture)

    PS C:\Users\hjc> [datetime]::ParseExact("20170618030000", "yyyyMMddhhmmss", [System.Globalization.CultureInfo]::InvarientCulture)

    Sunday, June 18, 2017 3:00:00 AM
    BadCat
        2
    BadCat  
    OP
       Aug 27, 2018
    @hjc4869 解决了 百度好多没找到方法 感谢
    geelaw
        3
    geelaw  
       Aug 27, 2018 via iPhone
    LuffyGu
        4
    LuffyGu  
       Oct 16, 2018
    头像不错
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2874 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 12:25 · PVG 20:25 · LAX 05:25 · JFK 08:25
    ♥ Do have faith in what you're doing.