开发者

Date time format convert in vb.net

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜