Datetime parsing

  • Thread starter Thread starter John Dann
  • Start date Start date
J

John Dann

I have some dates in a file that I need to read as strings in the
format eg '8.Aug.06' and then convert to a .Net date type. The date is
also available as day of the year, ie an integer.

Does VB.Net 2.0 have any direct method to turn a month abbreviated as
mmm into its numeric equivalent or alternatively a method using DOY?
There are obviously methods for the reverse process given a .Net date,
but I can't spot anything direct from which to build a date value.

JGD
 
John,

With the DateTime.parseExact you can mostly do everything.

http://msdn2.microsoft.com/en-us/library/w2sa9yss.aspx

Be also aware that it is not possible to create a DateTimeFormatInfo for a
neutral culture.
http://msdn2.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx

If the date is conform any standard British format and your computer is
localised as that you can mostly use the CDate as well, which is less
restrictive.

http://msdn2.microsoft.com/en-us/library/2dt118h2.aspx

I hope this helps,

Cor
 
Back
Top