Convert string to datetime in vb.net

后端 未结 3 437
温柔的废话
温柔的废话 2020-12-03 15:25

I have a datetime that looks like this:

201210120956
ccyyMMDDhhmm

When I try this:

Dim convertedDate As Date = Date.Parse(D         


        
3条回答
  •  失恋的感觉
    2020-12-03 15:59

    You can try with ParseExact method

    Sample

    Dim format As String  
    format = "d" 
    Dim provider As CultureInfo = CultureInfo.InvariantCulture
    result = Date.ParseExact(DateString, format, provider)
    

提交回复
热议问题