I have a form where I select a date.
when I print the POST, its there in the format m/d/Y
But I want to insert it into a mysql table
$out_date = date_format($in_date,'Y-m-d');
But its not returning anything:?
Am I missing something?
I have a form where I select a date.
when I print the POST, its there in the format m/d/Y
But I want to insert it into a mysql table
$out_date = date_format($in_date,'Y-m-d');
But its not returning anything:?
Am I missing something?
Here is the link to the relevant php.net support page about using this function.
http://php.net/manual/en/datetime.format.php
Search for string “Procedural style” on that page.
You need to pass that function a date object, not a string. Here is the example:
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.