p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   date in sql server and in visual studio (http://p2p.wrox.com/showthread.php?t=40154)

saif44 March 21st, 2006 07:45 PM

date in sql server and in visual studio
i have come across some very strange beheaviour using date in sql server and VS.
i am using date as follow: DD/MM/YYYY, this get accepted by the sqlserver when you input this date from a VS form. however, when you pass some date to the sql (for example to compare to dates) it considers as MM/DD/YYYY. i don't know what's happening.

all my settings in the system is set to DD/MM/YYYY.

is there any way that you can set to make both sides understand one format

anyone can help please?[V]

jbenson001 March 22nd, 2006 03:20 PM

The sql server date format is dd/mm/yyyy?

saif44 March 22nd, 2006 04:23 PM

So why when i pass a parameter as DD/MM/YYYY to the SQL, it considers it as MM/DD/YYYY. do you know anywhere where i can go and change the setting. i have sql server 2005 express edition.


jbenson001 March 22nd, 2006 05:02 PM

Sql server determines the date format based on the collation selected when the server was set up. In your case it sees dates as mm/dd/yyyy. Before you run a query you will need to use SET DATEFORMAT. Look it up in books on line

All times are GMT -4. The time now is 12:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.