开发者

Date calculation conversion issues

I'm trying to calculate a the date difference of date - day 开发者_开发百科where the result is date format.

Update PermanentArrears set duedate =  Cast(convert(char(8),Datediff(Day, [arrearsdays], [WorkingDate])) As Date)

At some point I got the right result but I do not anymore. Here is the error message I receive:

Conversion failed when converting date and/or time from character string.


You want to be using dateadd instead of datediff

EDIT: you don't need to convert - dateadd returns the same date format that is passed in

Update PermanentArrears 
    set duedate =  Dateadd(Day, [arrearsdays], [WorkingDate])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜