Migrating Date Functions from Access to SQL Server

This table shows the Microsoft® SQL Server™ equivalent function for each Microsoft Access function.

Access SQL Server
now(x) getdate(x)
date(x ) convert(datetime,convert(varchar,getdate(x)))
year(x) datepart(yy,x)
month(x) datepart(mm,x)
day(x) datepart(dd,x)
weekday(x) datepart(dw,x)
hour(x) datepart(hh,x)
minute(x) datepart(mi,x)
second(x) datepart(ss,x)
datepart("<Access datepart>", x) datepart(<SQL Server datepart>, x)
dateadd("<Access datepart>", x, y) dateadd(<SQL Server datepart>, x, y)
datediff("<Access datepart>", x, y) datediff(<SQL Server datepart>, x, y)

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.