Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Validation help?

Status
Not open for further replies.

rabinski

Programmer
May 13, 2005
21
GB
Gurus -

I need to strip out invlaid dates (eg leap years etc) -

Using this regex at the mo

if ($phone_num !~ /^[0-3][0-9]\/[0-1][0-9]\/[1-2][0-9][0-9][0-9]$/)

- This will not catch leap years or 39/16/2005 etc ...

Any help would be great chaps ....

Rab
 
Why not use Date::Manip?
All the hard work will have been done for you and it will be accurate and reliable.


Trojan.
 
yeah looking at it now - it is a bit of a read tho ;@)

Thought there may be a quicker fix ...
 
Quicker is often not necessarily better.
Date manipulation is surprisingly complex and notoriously difficult to get right.
Look at the Y2K problem as a simple example!


Trojan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top