Re:Date Problem
From: Vishal Parkar (vgparkar@hotmail.com)
Date: 03/08/03
- Previous message: Abhi: "Error when connecting through COM."
- In reply to: Daniel: "Date Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Vishal Parkar" <vgparkar@hotmail.com> Date: Sat, 8 Mar 2003 03:52:05 -0800
You can SET DATEFORMAT and modify code as follows.
create table test(dt datetime)
go
declare @dt varchar(32)
set @dt ='26/07/2002'
set dateformat dmy --change dateformat
insert into test values(convert(datetime,@dt)) ;
select * from test;
go
OR other method would be to use explicit coversion of the
date using CONVERT function.
create table test(dt datetime)
go
declare @dt varchar(32)
set @dt ='26/07/2002'
insert into test values(convert(datetime,@dt, 103)) ;
select * from test;
go
--Vishal
>-----Original Message-----
>Hi
>
>I've got a problem with date formatting. I'm accessing a
sqlServer 2000
>database using asp.net. When the dates are entered into
the database they
>appear in the format that I want them (dd/mm/yyyy). When
they are called
>from the database and displayed in the web page they are
also in this
>format. However when I come to update the date an
exception occurs. The
>data will only be updated if it is converted to the
mm/dd/yyyy format.
>
>Any Ideas?
>
>Cheers
>
>Daniel
>
>
>.
>
- Previous message: Abhi: "Error when connecting through COM."
- In reply to: Daniel: "Date Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|