Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-15-2004, 10:42 PM Validate date..
Unknown.

Posts: 1,693
Trades: 0
What I want is something that will check if a date is valid..

For example you can not set the day as 31 when theres only 30 in the month..

Would this be possible within php??

Thanks

-James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-15-2004, 11:07 PM
Unknown.

Posts: 1,693
Trades: 0
Don't worry.. Finally found it

-James

Last edited by Dark-Skys99; 08-16-2004 at 07:34 AM..
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 08-15-2004, 11:51 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Post your solution, someone might have the same problem as you did and they'll be greatful to find your answer through a search.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 08-16-2004, 08:32 AM Solution..
Unknown.

Posts: 1,693
Trades: 0
The Solution...

PHP Code:
<?
function isDateValid($value) { 
$strData strtok($value"/"); 
$intCount 1
while (
$strData) { 
if (
$intCount == 1) { 
$tmpmonth $strData

if (
$intCount == 2) { 
$tmpday $strData

if (
$intCount == 3) { 
$tmpyear $strData

$intCount $intCount 1
$strData strtok("/"); 
}  
if (
checkdate($tmpday,$tmpmonth,$tmpyear)) { 
return 
"Y"
} else { 
return 
"N"



/* sample use: */ 
/*Date format : dd/mm/yyyy */
$date "28/2/2004"
if (
isDateValid($date) == "Y") { 
echo (
"valid date");
} else { 
echo (
"invalid date");

?>
-James
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Validate date..
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13279 seconds with 12 queries