Hello,
If you know all the possible formats you can do something like this.
string[] expectedFormats = {"dd\r\d \o\f MMMM yyyy", "dd\s\t \o\f MMMM
yyyy", "dd\t\h \o\f MMMM yyyy"};
DateTime validDateTime = Response.Write(DateTime.ParseExact("03rd of
April 2006", expectedFormats,
System.Globalization.CultureInfo.CurrentUICulture,
System.Globalization.DateTimeStyles.AllowWhiteSpac es));
--------------------
From: "zsolt" <no@mail.com>
Subject: Date format problem
Date: Wed, 8 Mar 2006 19:16:44 +0100
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <#z**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: mail.itfi.no 194.248.208.94
Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.general:190426
X-Tomcat-NG: microsoft.public.dotnet.general
Hi,
I'm trying to convert a string to date by specifying the format. The value
is like this: "03rd of April 2006". Now this is converted fine by using
thefollowing format: "dd\r\d \o\f MMMM yyyy". The problem is of course that
thestring can be 01st of..., 04th of etc., meaning that I can't use the
"\r\d"format description for all possible values.
Any suggestions? Is there a wildcard i can use, like "dd\?\?"...
Thanks,
Zsolt
--
Thank You,
Nanda Lella,
This Posting is provided "AS IS" with no warranties, and confers no rights.