【问题标题】:VB.NET converting String into Date with specific formatVB.NET 将字符串转换为具有特定格式的日期
【发布时间】:2022-12-25 21:53:39
【问题描述】:

我有这种形式的字符串“29.07.2022”,我想将它转换为日期

当我尝试这个时:

DateTime.ParseExact("29.07.2022", "dd.mm.yyyy", Globalization.CultureInfo.InvariantCulture)

它返回错误:字符串未被识别为有效的日期时间

实现这一目标的最佳方法是什么?

【问题讨论】:

    标签: vba vb.net winforms


    【解决方案1】:
    DateTime.ParseExact("29.07.2022", "dd.MM.yyyy", Globalization.CultureInfo.InvariantCulture)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-30
      • 2014-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-10
      • 1970-01-01
      相关资源
      最近更新 更多