gcmachel
asked on
PHP date formatting
Hi this is my PHP code.
$d=date("Ymd");
echo date("Y/m/d",$d);
output 1970/08/21
what i expect is m/d/Y
let me know how we do it in PHP, I am sure the solution can be applied to any date that has been created in PHP.
Regards,P.
$d=date("Ymd");
echo date("Y/m/d",$d);
output 1970/08/21
what i expect is m/d/Y
let me know how we do it in PHP, I am sure the solution can be applied to any date that has been created in PHP.
Regards,P.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
best examples at http://in.php.net/date
ASKER
Hi angelII,
Perfect that works, but i was not able to store the value inside mysql, mysql puts the value as 0000-00-00. so i want to create a date object with $d=date("Ymd"); and format $d.
Please let me know if its possible.
Regards,G.
Perfect that works, but i was not able to store the value inside mysql, mysql puts the value as 0000-00-00. so i want to create a date object with $d=date("Ymd"); and format $d.
Please let me know if its possible.
Regards,G.
ASKER
I found the solution myself