开发者

Need similar function of strtotime( "next monday" ) in SQL Server

I need similar function of strtotime( "next monday" ) in SQL Serv开发者_运维百科er.


DateAdd(d, (8+@@DateFirst+DatePart(dw,GetDate()))%7, GetDate())

This gives you next Monday, at the current time-of-day; i.e. if you use it at 11:49 AM Wednesday, you'll get next Monday at 11:49 AM. If that's not what you want, look up functions DatePart, DateAdd, and DateDiff - you should be able to adjust it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜