Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Reversal Of Date Format

Author  Topic 

flinty82
Starting Member

1 Post

Posted - 2007-10-22 : 03:55:30
Hi Everyone,

I am running SQL Server on Windows 2000 Server Edition and have had a problem with the date format in some of the tables. Specifically all of the days and the months have swapped around where they logically can. The original data was all saved as dd/mm/yy but has now all swapped over to mm/dd/yy - unless of course it will not form a logical date.

The only thing which has happened which i can put this down to is that the server has just had service pack 3 installed on it. Has anyone ever encountered this before and if so is there an easy way to fix it?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-22 : 04:00:08
dates in the sql server are stored independant of the format.
by using datetime parameters you will avoid this trouble.
this is a problem of your client app and use of ad-hoc queries.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-22 : 04:01:45
You should always use datetime parameters and assign dates strings in YYYYMMDD HH:MM:SS format to avoid conflict with local settings

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

aarumugavel
Starting Member

8 Posts

Posted - 2007-10-22 : 05:09:58
The Sql Server default format is MM/dd/yyyy. so ur given input date format into swap.
so Better your given input format chages done with dd/MMM/yyyy (01/apr/2007) format. and also ur retrieve format changes into the dd/MMM/yyyy format.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-22 : 05:15:17
> The Sql Server default format is MM/dd/yyyy

how do you figure that?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-22 : 06:17:03
quote:
Originally posted by spirit1

> The Sql Server default format is MM/dd/yyyy

how do you figure that?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com


He must have run

dbcc useroptions

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -