convert a String to a Date

  • Thread starter Thread starter John A Grandy
  • Start date Start date
CType(string, date)

datevar = CDate(string) is shorter. You can also use Date.Parse or Date.ParseExact which can be used to parse a string in a specific format.
 
CDate is a holdover from VB 6.0. Many developers like to steer clear of
these functions because they cause more overhead than if the .NET equivalent
class is used.


Eduardo A. Morcillo said:
CType(string, date)

datevar = CDate(string) is shorter. You can also use Date.Parse or
Date.ParseExact which can be used to parse a string in a specific format.
 
Back
Top