TheConeHead
Programmer
Is there a way to take "23 Nov 2006" and use it to query a datetime field (i.e. 11/23/2006 7:45:12 PM)
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Declare @Temp DateTime
Set @Temp = '23 Nov 2006'
Select *
From Table
Where DateField >= @Temp
And DateField < @Temp + 1
DECLARE @Test varchar(50)
DECLARE @Test1 varchar(50)
DECLARE @Test2 varchar(3)
SET @Test = 'JanFebMarAprMayJunJulAugSepOctNovDec'
SET @Test1 = '23 Nov 2006'
SET @Test2 = SUBSTRING(@Test1,4,3)
print convert(datetime, RIGHT(@Test1,4)+RIGHT('00'+CAST(CharIndex(@Test2,@Test)/3+1 as varchar(2)),2)+LEFT(@Test1,2))
DECLARE @Test datetime
SET @Test = '23 Nov 2006'