Hi,
I am fetching date from the database which is submitted by user while form filling.
The date came from database 2011-11-15.

What i want to do,show date in below format.
2011-dec-15 or dec 15 2011

need help??

Recommended Answers

All 2 Replies

Hi,

As R0bb0b suggested you can use date() and strtotime() functions in php to format the date.

$d1 = "2011-11-15";
echo date("Y-M-d", strtotime($d1)); //  2011-Nov-15                
echo date("M d Y", strtotime($d1)); //  Nov 15 2011

From your question, i think you need to increment the month from the given date. Try with the following code to get this,

$d2 = strtotime("+1 month", strtotime($d1));
echo date("M d Y", $d2);  // Dec 15 2011
echo date("Y-M-d", $d2);  // 2011-Dec-15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.