Eight days a week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT input,
year(z|7^1),(datepart(y,z|7^1)+7)/8,z%8+1,expected_result
FROM(SELECT
datediff(d,2,input)z,*
FROM(values
('2001-01-01','2001, 1,1'),
('2001-01-08','2001, 1,8'),
('2001-01-09','2001, 2,1'),
('2001-12-31','2001,46,5'),
('2002-01-01','2001,46,6'),
('2002-01-04','2002, 1,1'),
('2002-12-29','2002,45,8'),
('2002-12-30','2003, 1,1'),
('2020-02-29','2020, 8,7'),
('2037-09-13','2037,32,5'),
('2061-04-23','2061,15,4'),
('2100-12-31','2101, 1,4'))h(input,expected_result))t

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results