• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

PHP date formatting

Hi this is my PHP code.

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.
  • 2
1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
echo $d;

Loganathan NatarajanLAMP DeveloperCommented:
best examples at http://in.php.net/date

gcmachelAuthor Commented:
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.

gcmachelAuthor Commented:
I found the solution myself
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now