i have three variables containing values shown below
$day=13
$month=2
$year=2013
i want to convert these three variable data into a date format in php and store in anoother variable Ho to do this??
PHP doesn't really have a date variable type, but it can handle time stamps; such a time stamp can be created with mktime()
:
$ts = mktime(0, 0, 0, $month, $day, $year);
This can then be used with date()
to format it:
$formatted = date('Y-m-d', $ts);