Seems to me a little bit strange, (or your teacher should have asked of
course this to you, and it is good practise in the .Net newsgroups not to
help with homework)
:-)
Cor
"Atul Rane" <AtulRane@discu ssions.microsof t.comschreef in bericht
news:1EC8F48C-2D55-4133-A6D0-18585EA0474C@mi crosoft.com...
>I want to restrict user to select received date greater then todays date
using RegularExpresio nValidator for this i want regular expression.
"Atul Rane" <AtulRane@discu ssions.microsof t.comwrote in message
news:1EC8F48C-2D55-4133-A6D0-18585EA0474C@mi crosoft.com...
>I want to restrict user to select received date greater then todays date
using RegularExpresio nValidator for this i want regular expression.
Selecting a date "greater than todays date" is going to be very
difficult with a regular expression. Instead you can use a CompareValidato r,
which lets you specify a ValueToCompare (that you can set to today's date in
code), an Operator which you can set to "greater than", and a Type that you
can set to "Date".
I want to restrict user to select received date greater then todays date
using RegularExpresio nValidator for this i want regular expression.
That is impossible: regex knows nothing about "dates" or "numbers", it
only deals with "strings".
With a somewhat simple expression you could forbid "very illegal"
dates, like day 43 or month 21. Using a bit more complex expression you
can limit days to 1-31 and months to 1-12.
To recognise the different length of the various maonths requires a
very complex expression. Leap-years are impossible to detect.
Duggi.
>
DateTime.Ticks. ToString() gives a string.
So it does not look impossible to compare that with Regex,
>
However, probably a little bit overdone,
>
Cor
>
You still can't write a regex to test if a date (whether specified as
dd-MM-yyyy, MM/dd/yyyy or yyyy/MM/dd) is later than some other date
(specified in the same syntax or as a 18+ digit number - the result of
Ticks.ToString( ))
Hans Kesting
>
"Duggi" <DuggiSrinivasa Rao@gmail.comsc hreef in bericht
news:6e5075c1-50ad-4304-89d9-eb97dd8ee106@o4 0g2000prn.googl egroups.com...
On Sep 25, 2:13 am, Atul Rane <AtulR...@discu ssions.microsof t.com>
wrote:
>I want to restrict user to select received date greater then todays date
>using RegularExpresio nValidator for this i want regular expression.
>
I think regular expressions Can not compare data... however they
enforce to be in cetrain format...
>
Cor:
Correct me if I am wrong...
>
-Cnu
ticks are just a long giving the ticks after 01-01-01 (in any time format)
At that time it was 1 a 10000000th of milliseconds later this was 2.
Therefore 2 was latter then 1.
Cor
"Hans Kesting" <news.hansdk@sp amgourmet.comsc hreef in bericht
news:uSq9L48HJH A.788@TK2MSFTNG P06.phx.gbl...
Cor Ligthert [MVP] submitted this idea :
>Duggi.
>>
>DateTime.Ticks .ToString() gives a string.
>So it does not look impossible to compare that with Regex,
>>
>However, probably a little bit overdone,
>>
>Cor
>>
>
You still can't write a regex to test if a date (whether specified as
dd-MM-yyyy, MM/dd/yyyy or yyyy/MM/dd) is later than some other date
(specified in the same syntax or as a 18+ digit number - the result of
Ticks.ToString( ))
>
Hans Kesting
>
>
>>I want to restrict user to select received date greater then todays date
>>using RegularExpresio nValidator for this i want regular expression.
>>
>I think regular expressions Can not compare data... however they
>enforce to be in cetrain format...
>>
>Cor:
>Correct me if I am wrong...
>>
>-Cnu
Hans,
>
ticks are just a long giving the ticks after 01-01-01 (in any time format)
>
At that time it was 1 a 10000000th of milliseconds later this was 2.
>
Therefore 2 was latter then 1.
>
Cor
Cor,
That is true. But the original question was "how to write a regex to
validate that a date is *after today*". So how would you do that if the
user had typed in "29-9-2008"?
>>Duggi.
>>>
>>DateTime.Tick s.ToString() gives a string.
>>So it does not look impossible to compare that with Regex,
>>>
>>However, probably a little bit overdone,
>>>
>>Cor
>>>
>>
>You still can't write a regex to test if a date (whether specified as
>dd-MM-yyyy, MM/dd/yyyy or yyyy/MM/dd) is later than some other date
>(specified in the same syntax or as a 18+ digit number - the result of
>Ticks.ToString ())
>>
>Hans Kesting
>>
>>
>>>
>>"Duggi" <DuggiSrinivasa Rao@gmail.comsc hreef in bericht
>>news:6e5075 c1-50ad-4304-89d9-eb97dd8ee106@o4 0g2000prn.googl egroups.com...
>>On Sep 25, 2:13 am, Atul Rane <AtulR...@discu ssions.microsof t.com>
>>wrote:
>>>I want to restrict user to select received date greater then todays date
>>>using RegularExpresio nValidator for this i want regular expression.
>>>
>>I think regular expressions Can not compare data... however they
>>enforce to be in cetrain format...
>>>
>>Cor:
>>Correct me if I am wrong...
>>>
>>-Cnu
Comment