Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 convert date to international

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2007-02-11 : 12:34:20
I am finding that I am constantly converting a UK date to international.. now in my asp code i change 11/02/2007 to 20070211 but is there an easier way to do it in my sql statement.
my problem is my db is in US date format so I must use international date format. I just want to say where date>=11/02/2007 and <=11/02/2007n 23:59 --

any easier way to do this they writing the code to convert the date in asp?

nr
SQLTeam MVY

12543 Posts

Posted - 2007-02-11 : 12:45:18
Not sure what the problem is.

If the dates are datetime then you don't have a convertion issue.
If they are 'yyyymmdd' again there is no issue.
If you use 'dd/mm/yyyy' then you have an issue.
You either need convert(datetime,dte,103) or set dateformat dmy.

The date>=11/02/2007 and <=11/02/2007n 23:59 --
would be

where date >= convert(datetime,@dte,103) and date < convert(datetime,@dte,103) + 1
or you could
datediff dd,date,convert(datetime,@dte,103)) = 0



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -