Skip to content
Advertisement

Change default date format of the asp sql database ( the one storing the values)

I have a gridview and SqlDatasource. I have a column called Date VMS which is type Date. I’ve noticed that the format for adding a date won’t allow adding a date like: 30/02/2012. ( DD/MM/YYYY)

I have an Excel sheet from which I’m copying the rows and I’m adding them in the table.

enter image description here

The format of the date in the Excel is: DD/MM/YYYY, so as we can see when I’m pasting the value in the table, the dates which are not format MM.DD.YYYY are not added.

  • -And some of them : for example 7/12/2012, the program assimilate them as MM/DD/YYY.

I’ve also added the date manually in the second cell of the first row and the database doesn’t allow that format.

Is there any way to change the date format so I can add dd.mm.yyyy?

Advertisement

Answer

There is only 2 solution to your problem. The first and less complicated is the do like Bala suggest, add a new column with the right format for SQL Server.

The other solution is to go in the “Regional and Language” option the control panel and change the Date format in the Advance Setting. SQL Server use those setting to validate and display Date value. The problem with using such unusual date format might cause problem to other software.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement