December 18, 2003 at 12:16 pm
I have a date in british format 31/12/03
I need to convert it into a default sql datetime format i.e 2003-12-31 00:00:00
Can anyone help me please. I know it is simple but get stuck with dates every time!
Thanks
Karl
December 18, 2003 at 12:33 pm
I do not know your context, but try...
Declare @Test DateTime
SET DATEFORMAT dmy
Select @Test = '31/12/03'
Print Convert(VarChar(25), @Test)
SET DATEFORMAT mdy -- back to US default
Once you understand the BITs, all the pieces come together
December 18, 2003 at 12:33 pm
This should work:
CONVERT(datetime, datefield, 120)
Refer to the BOL, use the INDEX tab and enter CONVERT.
-SQLBill
December 18, 2003 at 12:48 pm
Thanks
I will give it a try
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply