Home All Groups Group Topic Archive Search About
Author
7 Aug 2006 2:57 PM
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

Author
7 Aug 2006 3:46 PM
Cor Ligthert [MVP]
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

Show quoteHide quote
"John Dann" <n***@prodata.co.uk> schreef in bericht
news:jrked29bqgfo40ogotj6sf9gme8m6u9len@4ax.com...
>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