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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.