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.
精彩评论