Link to home
Start Free TrialLog in
Avatar of gcmachel
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.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gcmachel
gcmachel

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.
I found the solution myself