PDA

View Full Version : min date not sure the correct code


Sades
05-18-2010, 09:14 AM
Hello again im trying to validate a date field with a min date

i have try

$WAFV_Errors .= WAValidateDT(((isset($_POST["despachado"]))?$_POST["despachado"]:"") . "",true,"\b\d{4}-(1[0-2]|0[1-9])-([12]\d|3[0-1]|0[1-9])\b","strtotime(\"+1 day\")","",false,".*","","",true,2);

also have try

$WAFV_Errors .= WAValidateDT(((isset($_POST["despachado"]))?$_POST["despachado"]:"") . "",true,"\b\d{4}-(1[0-2]|0[1-9])-([12]\d|3[0-1]|0[1-9])\b","".(date(\\"Y-m-d\\", mktime(0, 0, 0, date("Y"), date("m"), date("d") + 1))) ."","",false,".*","","",true,2);

none work i have readed most post about it here all i need for a date YYYY-mm-dd is to avoid ppl submiting today or tomorrow date for now im trying that they are allow to submit if the date they chose is not today date but no idea how i thought it would work on the min date field but not sure the correct code any help please

Jason Byrnes
05-19-2010, 08:46 AM
how are you entering the code for the minimum date in the wizard? are believe the way you are entering it in the wizard is the issue.


In the wizard, put the following in the Min Date filed to return tomorrows date:
<?php echo(date("Y/m/d", mktime(0,0,0,date("m"),date("d")+1, date("y")))); ?>

Sades
05-20-2010, 05:08 PM
at the end i placed it like this and it worked

<?php echo date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); ?>

Thanks

Jason Byrnes
05-21-2010, 06:29 AM
OK, glad to hear it is working.