Jump to content

Changing the format of a date.


wright67uk

Recommended Posts

How can I change a date from YYYY-MM-DD to DD/MM/YYYY ?

 

I have a date picker in a form which always posts in this format: 2013-01-30

When I process the form I would like to store this date into a variable but in this format 30/01/2013.

 

So I need to replace dashes for slashes, and reverse the order of year, month, and date.

Link to comment
https://forums.phpfreaks.com/topic/272764-changing-the-format-of-a-date/
Share on other sites

You need to store the date in a DATE data type with the YYYY-MM-DD format. The only time you should format as DD/MM/YYYY is when you want to display it.

 

edit: damn, the forum's post notification (or lack of) gets a -20 likes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.