Discussion:
SQL Server equivalent
(too old to reply)
John
2009-05-04 02:22:23 UTC
Permalink
Hi

What are the sql server equivalents of;

Date()+180
Now()
Year([Date])
Month([Date])
Day([Date])

Many Thanks

Regards
Alex Dybenko
2009-05-04 14:15:57 UTC
Permalink
Hi,
there is a GetDate() function, which is similar to Now()
to get date only you can use convert(varchar(10),getdate(),112 )

to add days - use DateAdd()

year, month, day - there are similar functions in tsql
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
Post by John
Hi
What are the sql server equivalents of;
Date()+180
Now()
Year([Date])
Month([Date])
Day([Date])
Many Thanks
Regards
Klaus Oberdalhoff
2009-05-04 15:10:15 UTC
Permalink
Hi,
Date Time Infos on SQL Server
additional to Alex info:

an older article (if using 2008 there are new date & time funktions, which
are not covered by this article)

http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx

http://www.sql-server-performance.com/articles/dev/datetime_datatype_p1.aspx

http://www.sql-server-performance.com/articles/dev/Compare_Dates_p1.aspx

http://blogs.msdn.com/jongallant/archive/2008/08/15/new-sql-server-date-datatypes-date-time-datetime2-datetimeoffset.aspx

mfg

Klaus

Loading...