Click here to Skip to main content
15,892,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am faced with an issue that I find really weird.

Currently we have a system that is working fine on Windows Server 2008 R2 but decided to migrate the system to Windows Server 2012 R2.

My date formats have now gone off on the new server and it ignores the formatting that is placed on my text box. The formatting still works perfect from the 2008 box.

I did write code to get around this issue in 1 place but there are tons of places that will need the code change and the client refuses this.

Is there some update that could be missing from the box or a setting that can be changes in order to get around this.

The date format that I want is dd/MM/yyyy but on the 2012 box it goes as dd-MM-yyyy for some reason.

thanks
Posted

1 solution

The default date format is controlled with the language settings of the database. So check your instance (and database) configurations. If I recall correctly, dd-mm-yyyy is the default format for U.S. English.

Date format can also be set using SET DATEFORMAT[^] to override language specific setting.

But in the long run I'd suggest modifying the program so that language settings do not matter. Valus should always be handled using parameters and if literals are needed for some reason they should always be converted properly using for example CONVERT function.
 
Share this answer
 
v2
Comments
Kats2512 15-Jul-15 7:39am    
yes it is default and works fine in the 2008 box, on 2012 it does not format to how I want it.
Wendelius 15-Jul-15 7:45am    
On the 2012 database try running
dbcc useroptions
What are the values of
- language
- dateformat
- datefirst
Kats2512 15-Jul-15 7:47am    
it is a 2008 database, 2012 server software
Wendelius 15-Jul-15 7:49am    
Yep, sorry about the wrong number. What were the results?
Kats2512 15-Jul-15 7:51am    
language - us_english
dateformat - mdy
datefirst - 7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900