开发者

Date time format convert in vb.net

开发者 https://www.devze.com 2023-03-24 04:29 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消