Posted: Thu Mar 22, 2007 7:29 pm
guys this is exactly what i need but the thing doesnt work? if it is just me being retarded can u please show a example how to use it, thank you
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
this 1Code: Select all
function MyCheckDate( $postedDate ) {
if ( preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $postedDate) ) {
list($year , $month , $day) = explode('-',$postedDate);
return checkdate($month , $day , $year);
} else {
return false;
}
}Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
function MyCheckDate( $postedDate ) {
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $postedDate, $datebit)) {
return checkdate($datebit[2] , $datebit[3] , $datebit[1]);
} else {
return false;
}
}Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
this is correct yes ?Code: Select all
<?
$test = '12-12-2008';
MyCheckDate( $test );
function MyCheckDate( $postedDate ) {
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $postedDate, $datebit)) {
return checkdate($datebit[2] , $datebit[3] , $datebit[1]);
} else {
return false;
}
}
?>Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]You need to add some code to do the comparison.feyd wrote:It doesn't print anything, if that's what you're looking for.
Code: Select all
<?
$test = '2008-12-12';
MyCheckDate( $test );
function MyCheckDate( $postedDate ) {
if (preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', $postedDate, $datebit)) {
print_r($datebit);
return checkdate($datebit[2] , $datebit[3] , $datebit[1]);
} else {
return false;
}
}
?>