I have created a table into my database which has a coloumn with datatype defined as DATETIME. The normal SQL date order is MM-DD-YYYY, however I need to enter it in format DD-MM-YYYY.

Is it possible to insert into SQL SERVER database where field is formatted as DATETIME , a date in format DD-MM-YYYY instead in format MM-DD-YYYY
If not possible, can I convert a value posted from ASP.NET web page in format DD-MM-YYYY into the format MM-DD-YYYY using the MySQL syntax or I should use ASP>NET to post the value in YYYY-MM-DD format?

Recommended Answers

Try this code:
DATE_FORMAT(date,format)

So your code would look like DATE_FORMAT(date, '%d-%m-%Y')

You can read more here: http://www.w3schools.com/sql/func_date_format.asp

Hope that helps,

Jump to Post

All 2 Replies

Be a part of the DaniWeb community

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