all groups > sql server programming > may 2005 >
You're in the

sql server programming

group:

Date Issue!


Date Issue! AJ
5/22/2005 8:00:01 PM
sql server programming:
I am storing dates in SQL Server 2000 (Using ASP).
The date is getting validated against the Ymd format, by using SET DATEFORMAT.

In the Enterprise Manager - the date is displayed in local format (dmY).
When i run a store procedure manually it is returned as Ymd.
When i execute stored procedure from asp and load data into a recordset it is
displayed in mdY Format.

This is obviously quite confusing. Can anyone give me some insight into what
RE: Date Issue! Renjith
5/22/2005 9:49:01 PM

Hi

Seems u have to format date using FORMAT Function

renjith

[quoted text, click to view]
Re: Date Issue! Renjith
5/22/2005 10:38:01 PM

Hi

since AJ is using ASP , there is format function in VB for formatting data
so tht he can give as Format(DateColumn, "Ymd").

Renjith



[quoted text, click to view]
Re: Date Issue! Jens Süßmeyer
5/23/2005 12:00:00 AM
OK, that makes sense, i just thought you mean th non-existing function
FORMAT for TSQL

--
HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
"Renjith" <Renjith@discussions.microsoft.com> schrieb im Newsbeitrag
news:6F1D14DE-AB4F-4CE9-B7BE-6FDC5C1772EC@microsoft.com...
[quoted text, click to view]

Re: Date Issue! Jacco Schalkwijk
5/23/2005 12:00:00 AM
The regional settings on your computer influence how the date is presented
in Enterprise Manager. So if the regional settings are British Enterprise
Manager will _display_ the dates in dd/mm/yyyy. Query Analyzer isn't
influenced by the regional settings, and will always display dates in
yyyy-mm-dd hh:mm:ss, which is known as the ODBC canonical dateformat.

However, how SQL Server interprets the dateformat of strings depends on the
settings for your login in SQL Server. In Enterprise Manager, look under
<Server>\Security\Logins and look at the Default Language for your username
(or BUILTIN\Administrators if you are a Windows administrator on your local
machine).

To avoid problems with dates as strings, use the formats that are always
interpreted the same by SQL Server independent of any settings:
yyyymmdd and
yyyy-mm-ddThh:mm:ss


--
Jacco Schalkwijk
SQL Server MVP


[quoted text, click to view]

Re: Date Issue! Tibor Karaszi
5/23/2005 12:00:00 AM
[quoted text, click to view]

.... unless you check Tools, Options, Connections, "Use regional settings when displaying ... dates
and times". :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]

Re: Date Issue! Jens Süßmeyer
5/23/2005 12:00:00 AM
I don´t know which Function you mean with FORMAT, but here is another option
for that. A good pratice for me is to get the data back in a very common
format and to format it at the client side. The settings the date and time
is formatted depends on some settings concerning the client, the User
connnction to SQL Server (with it´s special user localized settings) or the
server settings. Perhaps you should read here a little bit further:

http://www.karaszi.com/SQLServer/info_datetime.asp#OutputFormats

--
HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
"Renjith" <Renjith@discussions.microsoft.com> schrieb im Newsbeitrag
news:A2A764AE-4BD0-4B0F-B5FF-A9FF40B6060F@microsoft.com...
[quoted text, click to view]

RE: Date Issue! JosephPruiett
5/23/2005 6:32:12 AM
You need to change the query in all enviornments to use the convert date
standard formats.
select convert(nvarchar,getdate(),101)

Which returns in mm/dd/yyyy format.
05/23/2005

Refer to books online and search for CAST and CONVERT as search criteria and
you will find the list of output standards.

[quoted text, click to view]
AddThis Social Bookmark Button