473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

RegularExpresionValidator for date

I want to restrict user to select received date greater then todays date
using RegularExpresionValidator for this i want regular expression.
Sep 25 '08 #1
8 1897
Atul,

I am curious, why not normal methods?

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" <At******@discussions.microsoft.comschreef in bericht
news:1E**********************************@microsof t.com...
>I want to restrict user to select received date greater then todays date
using RegularExpresionValidator for this i want regular expression.

Sep 25 '08 #2
"Atul Rane" <At******@discussions.microsoft.comwrote in message
news:1E**********************************@microsof t.com...
>I want to restrict user to select received date greater then todays date
using RegularExpresionValidator 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 CompareValidator,
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".

Sep 25 '08 #3
It happens that Atul Rane formulated :
I want to restrict user to select received date greater then todays date
using RegularExpresionValidator 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.

Hans Kesting
Sep 25 '08 #4
On Sep 25, 2:13*am, Atul Rane <AtulR...@discussions.microsoft.com>
wrote:
I want to restrict user to select received date *greater then todays date
using RegularExpresionValidator *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
Sep 25 '08 #5
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
"Duggi" <Du***************@gmail.comschreef in bericht
news:6e**********************************@o40g2000 prn.googlegroups.com...
On Sep 25, 2:13 am, Atul Rane <AtulR...@discussions.microsoft.com>
wrote:
I want to restrict user to select received date greater then todays date
using RegularExpresionValidator 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
Sep 26 '08 #6
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

>
"Duggi" <Du***************@gmail.comschreef in bericht
news:6e**********************************@o40g2000 prn.googlegroups.com...
On Sep 25, 2:13 am, Atul Rane <AtulR...@discussions.microsoft.com>
wrote:
>I want to restrict user to select received date greater then todays date
using RegularExpresionValidator 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

Sep 26 '08 #7
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

"Hans Kesting" <ne*********@spamgourmet.comschreef in bericht
news:uS*************@TK2MSFTNGP06.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

>>
"Duggi" <Du***************@gmail.comschreef in bericht
news:6e**********************************@o40g200 0prn.googlegroups.com...
On Sep 25, 2:13 am, Atul Rane <AtulR...@discussions.microsoft.com>
wrote:
>>I want to restrict user to select received date greater then todays date
using RegularExpresionValidator 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

Sep 26 '08 #8
Cor Ligthert[MVP] wrote :
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"?

Hans Kesting
>
"Hans Kesting" <ne*********@spamgourmet.comschreef in bericht
news:uS*************@TK2MSFTNGP06.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

>>>
"Duggi" <Du***************@gmail.comschreef in bericht
news:6e**********************************@o40g20 00prn.googlegroups.com...
On Sep 25, 2:13 am, Atul Rane <AtulR...@discussions.microsoft.com>
wrote:
I want to restrict user to select received date greater then todays date
using RegularExpresionValidator 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


Sep 29 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
9
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think...
30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
3
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
1
by: Liz Malcolm | last post by:
Hello and TIA. I have a DE form with an option group that if daily is selected todays date is used for start and end date, if weekly is selected Monday - Friday is used. I am trying to add a...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.