Re: Type Conversion with Date formatted as YYYYMMDD
- From: "Mike Hofer" <kchighland@xxxxxxxxx>
- Date: 15 Mar 2007 08:28:03 -0700
On Mar 14, 3:58 pm, "Branco Medeiros" <branco.medei...@xxxxxxxxx>
wrote:
Mike wrote:
I have a string variable containing a date formatted as YYYYMMDD
For example - Dim x as string = "20070314"
If I try to perform a type conversion as follows I get an error:
Dim y as Date = CDATE(x)
<snip>
I guess you'll be glad to know that the Date class has a Shared method
to do just that:
Dim D As Date = Date.ParseExact(X, "yyyyMMdd", Nothing)
HTH.
Regards,
Branco.
It never ceases to amaze me the kinds of stuff that I overlook in the
Framework. I use the DateTime class all the time. I don't know how
many times I've manually coded that solution, and didn't need to. I
should have figured there'd be a Framework method for handling it. I
just didn't look in the right place for it.
Thanks for pointing that out, Bronco.
.
- Follow-Ups:
- Re: Type Conversion with Date formatted as YYYYMMDD
- From: Branco Medeiros
- Re: Type Conversion with Date formatted as YYYYMMDD
- References:
- Re: Type Conversion with Date formatted as YYYYMMDD
- From: Branco Medeiros
- Re: Type Conversion with Date formatted as YYYYMMDD
- Prev by Date: Re: Does it make sense in FormClosed to do Me.Dispose
- Next by Date: Re: Type Conversion with Date formatted as YYYYMMDD
- Previous by thread: Re: Type Conversion with Date formatted as YYYYMMDD
- Next by thread: Re: Type Conversion with Date formatted as YYYYMMDD
- Index(es):
Relevant Pages
|