String to Date in VB.Net?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

This seems simple but I don't know what I am doing wrong.

I have a string as "15122004"

I want to convert this to a date.

I have Option Strict On.

How can I convert this string to a date in format ("dd/mm/yyyy") without
turning off Option Strict?

Thanks.
 
Hi,

Try DateTime.ParseExact().

Eg: DateTime.ParseExact ("15122004", "ddMMyyyy", Nothing)

Hi,

This seems simple but I don't know what I am doing wrong.

I have a string as "15122004"

I want to convert this to a date.

I have Option Strict On.

How can I convert this string to a date in format ("dd/mm/yyyy") without
turning off Option Strict?

Thanks.
 
Back
Top