Re: Date Problems - ASP/SQL
From: Aaron Bertrand - MVP (aaron_at_TRASHaspfaq.com)
Date: 05/13/04
- Next message: Fawke101: "Re: Date Problems - ASP/SQL"
- Previous message: Bob Barrows [MVP]: "Re: Array with blank value"
- In reply to: Fawke101: "Date Problems - ASP/SQL"
- Next in thread: Fawke101: "Re: Date Problems - ASP/SQL"
- Reply: Fawke101: "Re: Date Problems - ASP/SQL"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 May 2004 10:51:59 -0400
> I have a date field in SQL server - that holds dates as DD/MM/YYYY format
> (GB).
(a) SQL Server has columns, not fields.
(b) no, a DATETIME column does NOT store DD/MM/YYYY format. Maybe that's
what Enterprise Manager shows you, based on your regional settings. But it
is NOT what's stored in the database.
(c) the safest format is ISO standard: YYYYMMDD. YYYY/MM/DD could still
fail in certain scenarios, e.g. run this script on a scratch system, and
you'll see that YYYY/MM/DD will fail.
PRINT '--- FRENCH ---'
SET LANGUAGE FRENCH
DECLARE @dt SMALLDATETIME
SET @dt = '2004/11/13'
PRINT @dt
GO
DECLARE @dt SMALLDATETIME
SET @dt = '20041113'
PRINT @dt
GO
PRINT '--- US ENGLISH ---'
SET LANGUAGE ENGLISH
DECLARE @dt SMALLDATETIME
SET @dt = '2004/11/13'
PRINT @dt
GO
DECLARE @dt SMALLDATETIME
SET @dt = '20041113'
PRINT @dt
GO
PRINT '--- UK ENGLISH ---'
SET LANGUAGE BRITISH
DECLARE @dt SMALLDATETIME
SET @dt = '2004/11/13'
PRINT @dt
GO
DECLARE @dt SMALLDATETIME
SET @dt = '20041113'
PRINT @dt
GO
-- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/ > > Now, i have an ASP application that Adds/Edits records in this table; and i > am having real problems with the date field in the ADD and EDIT (update) > part for this app. > > Basically, i receive and Error as below: > > **** > Error Type: > Microsoft OLE DB Provider for ODBC Drivers (0x80040E07) > [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data > type to a datetime data type resulted in an out-of-range datetime value. > /add.asp, line 105 > **** > > This occurs when i try to input a date in the format of DD/MM/YYYY through > an ASP Form. When i try it as MM/DD/YYYY it works great, I need it as GB not > US! > > Any ideas how i can fix this? > I have already entered this at the top of the ADD/Edit page: > > <%session.LCID=2057%> (just a stab in the dark) > > Any ideas much appreciated > > -- > Thanks in advance > > Fawke > > Please remove ANTI and SPAM > from my email address before emailing me. > > www.bradflack.com > >
- Next message: Fawke101: "Re: Date Problems - ASP/SQL"
- Previous message: Bob Barrows [MVP]: "Re: Array with blank value"
- In reply to: Fawke101: "Date Problems - ASP/SQL"
- Next in thread: Fawke101: "Re: Date Problems - ASP/SQL"
- Reply: Fawke101: "Re: Date Problems - ASP/SQL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|