Showing posts with label String to Date. Show all posts
Showing posts with label String to Date. Show all posts

Wednesday, March 21, 2012

.Net change string to date

Example


        Dim orderCreatedDateRaw As String = ""
        Dim tempTime As String = "201203220836"
        Dim dtDate As DateTime
        dtDate = DateTime.ParseExact(tempTime, "yyyyMMddHHmm", CultureInfo.CurrentCulture)
        orderCreatedDateRaw = dtDate.ToString("yyyy-MM-dd")

dont forget to import "System.Globalization"