Click to See Complete Forum and Search --> : date time format function required


AliRaza
December 18th, 2003, 05:32 AM
hi,

I have a celebrity table with there date of birth field. i just want to write a query which return me the celebs who's DOB is in between next 14 days.

i have wrote this query in MySQL 4.0. then i shifted my DB from MySQL to SQL server 2000.
the query in MySQL is


SELECT name,dob
FROM celeb
WHERE date_format(dob,'%c-%e') between date_format(current_date(),'%c-%e') and date_format(DATE_ADD(current_date(), INTERVAL 7 DAY),'%c-%e')

dateformat function formats the date in month and day

you can help me by just replacing this function (date_format) with any appropriate function. or u can also suggest me any alternate query with same result

thankx in advance

buser
December 18th, 2003, 08:26 AM
see CAST and CONVERT (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_2f3o.asp) + Date and Time Functions (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_fa-fz_2c1f.asp) ... + BOL (http://www.microsoft.com/downloads/details.aspx?FamilyId=683D71A6-BCF4-45A6-A2E2-F6AB5BE3EF12&displaylang=en)