i have question, i am using PHP script, there is something wrong when i add date to my database…
how can i fix/re-arrange this date
date( "Oct 18, 2012 05:06:42" );
my database accept only 2012-10-19 05:06:42
but i am receiving different form which is this Oct 18, 2012 05:06:42
here are my example code
$cocod = date( 'Oct 18, 2012 05:06:42' );//'Oct 18, 2012 2012-10-18';
$get = strtotime(date("Y-m-d H:m:s", strtotime($cocod)) . " +30 day");
$setex = date( 'Y-m-d H:m:s', $get );
echo $setex;
thank you…
You can convert your formatted date back to a timestamp using the DateTime class
In your example above i can see you even wanted to add 30 days. You could do that like this:
If you now want to format your date again, do the following:
For further reading take a look at the DateTime class on php.net