Monday, 19 September 2011

Date additions (T-SQL)

Adding number of x to a date, where x can be: year=yy, month=m, dayofyear=y, day=d, week=wk, hour=hh, minute=mi, second=ss.

For example adding 260 days to New Year's day 2011:

print dateadd(d, 260, '2011-01-01')

 
This should return Sep 18 2011



No comments:

Post a Comment