Jump to content

Dates and European date format


Petty_Crim

Recommended Posts

ATM my database is using an American style date format with the year coming first, then the month then the day, is there a way to set it so it goes day, month, year?

 

Basically how it works is I got 3 drop down boxes with days, months and years in it. The user choose the desired date clicks a button and it updates the db. My problem is its has that American format and if I put it as text then I won't be able to do calculations or sorts on the date so I need it as a date.

 

Also do I need to actually change anything in my mysql data base in regards to the date field atm I got it set as a date is there any additional things I gotta change?

 

 

Link to comment
https://forums.phpfreaks.com/topic/57843-dates-and-european-date-format/
Share on other sites

I think there is a way, but that is the basis behind all mysql systems.

 

You'd be better off just formatting the date in the mysql query. eg

 

SELECT DATE_FORMAT(`datecolumn`, '%d/%c/%Y') from ... WHERE ...

 

that would brind the date in the table out inthe form of DD/MM/YYYY.

 

 

I find it easier to store dates in thte american format of yyyy/mm/dd as I can thten order items from the database by date, without having to add extra code.

I then 're-arrange' the date if I need to display it to dd/mm/yyyy, but leaving in american format in thte database.

I find it easier to store dates in thte american format of yyyy/mm/dd as I can thten order items from the database by date, without having to add extra code.

I then 're-arrange' the date if I need to display it to dd/mm/yyyy, but leaving in american format in thte database.

Yep thats what this is doing, they are stored in American format in the database but when I show it on screen it comes out as European format.

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.