Yo can also use a function for all your dates needs !!!
Here is what I'm using:
<?php
//###################
//# RETURN DIFERENT DATE FORMATS FROM CURRENT DATE ^ TIME
function getdates($type){
$time=time();
$weekday=ucfirst(strftime ("%A", $time));
$month=ucfirst(strftime ("%B", $time));
switch($type){
//Return day
case day:
return date( "d", $time );
break;
//Return month
case month:
return date( "m", $time );
break;
//Return year
case year:
return date( "Y", $time );
break;
//Return 18:00 05-12-2003
case 1:
return date( "h:m d-m-Y", $time );
break;
//Return 05-12-2003 18:00
case 2:
return date( "d-m-Y", $time );
break;
//Return Tuesday, January 14 2003, 18:00
case 3:
return strftime( "$weekday, $month %d %Y", $time );
break;
//Return 2003-01-14
case 4:
return date( "Y-m-d");
break;
//Return Next Month as 14/02/2003
case 5:
$nextmonth = mktime (0,0,0,date("m")+1,date("d"), date("Y"));
return date( "d/m/Y" ,$nextmonth );
break;
//Return Date 15 days from now as 14/02/2003
case 6:
$next15days = mktime (0,0,0,date("m"), date("d")+15, date("Y"));
return date( "d/m/Y" ,$next15days );
break;
//Return Next Week date as 14/02/2003
case 7:
$next7days = mktime (0,0,0,date("m"), date("d")+7, date("Y"));
return date( "d/m/Y" ,$next7days );
break;
case 8:
//Return date as 20030114
return date( "Ymd", $time );
break;
}
}
?>
Example:
<?= getdates(1); ?> <br>
<?= getdates(2); ?> <br>
<?= getdates(3); ?> <br>
<?= getdates(4); ?> <br>
<?= getdates(5); ?> <br>
<?= getdates(6); ?> <br>
<?= getdates(7); ?> <br>
<?= getdates(8); ?> <br>
<?= getdates(day); ?> <br>
<?= getdates(month); ?> <br>
<?= getdates(year); ?> <br>
In your case <input type="hidden" name="date" value="<?= getdates(4);">