我从源获取日期时间为20110731183330。我想把它转换成'7/31/2011 06:33:30 PM'。在vb.net中是否有一行代码?
那就是:
Dim result As Date = Date.ParseExact(datestring, "yyyyMMddHHmmss")
可以是…
Dim CustomDate As Date = Date.ParseExact(yourdate, "MM/dd/yyyy hh:mm:ss tt", Globalization.DateTimeStyles.None)
Dim result As Date = Date.ParseExact(dt, "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture)