Jump to content

mysql date


misheck

Recommended Posts

I am developing a sample application and would like a user to have a drop down calendar and select a date from there. Does anyone have a work around on inserting a date into Mysql DATE column.

 

My problem is at the moment I have been restricted to entering the date as 2009-01-02 but I am in the UK where we accustommed to entering the date as 02-01-2010. Is there a way I can modify mysql column to take the values that way?

 

Link to comment
https://forums.phpfreaks.com/topic/188037-mysql-date/
Share on other sites

To take a date in any format consisting of numeric values for the year, month, and day and produce a YYYY-MM-DD format, it is generally fastest to do this -

 

A) Separate the date into the individual year, month, and day values - explode

B) Validate the date (everyone IS validating their user supplied data?) - checkdate

C) Concatenate the individual parts with the '-' separator character to get the desired format.

Link to comment
https://forums.phpfreaks.com/topic/188037-mysql-date/#findComment-992692
Share on other sites

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.