LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-08-2006, 01:43 PM   #1
tooparam
Member
 
Registered: Nov 2005
Location: India
Distribution: Slackware
Posts: 51

Rep: Reputation: 15
simple date validation in PHP


How can I validate a date in YYYY-MM-DD format

where MM ranges from 01 to 12
DD ranges from 01 to 31

How can I fish out wrong entries like 1975-02-30 as there are 28 days in February in a non-leap year.

Thanks
 
Old 04-08-2006, 01:50 PM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,352

Rep: Reputation: 129Reputation: 129
You probably want to use the strtotime() function
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php validation logic spoody_goon Programming 5 01-14-2006 07:31 PM
Confused trying to do password validation in PHP Pcghost Programming 4 02-02-2004 12:10 PM
Form validation problem (PHP+MySQL) linuxfond Programming 13 09-08-2003 12:11 PM
JavaScript inside a CGI for date validation....doesn't work!! vous Programming 3 08-27-2003 04:49 PM
simple date script question Cynthia Blue Programming 3 01-13-2003 03:15 PM


All times are GMT -5. The time now is 05:22 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration