I'm getting date-time from a source as 20110731183330. I want to convert it to '7/31/2011 06:33:30 PM'. Is there a开发者_开发问答 one line code for the same in vb.net?
That would be:
Dim result As Date = Date.ParseExact(datestring, "yyyyMMddHHmmss")
It can be...
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)
then we can format it as required.
精彩评论