mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fixed wrong toISOWeek result for 1970 year
This commit is contained in:
parent
79d2f1f034
commit
1610bcca89
@ -0,0 +1,15 @@
|
|||||||
|
0000-00-00 1 1970
|
||||||
|
1970-01-02 1 1970
|
||||||
|
1970-01-03 1 1970
|
||||||
|
1970-01-04 1 1970
|
||||||
|
1970-01-05 2 1970
|
||||||
|
1970-01-06 2 1970
|
||||||
|
1970-01-07 2 1970
|
||||||
|
1970-01-08 2 1970
|
||||||
|
1970-01-09 2 1970
|
||||||
|
1970-01-10 2 1970
|
||||||
|
1970-01-11 2 1970
|
||||||
|
1970-01-12 3 1970
|
||||||
|
1970-01-13 3 1970
|
||||||
|
1970-01-14 3 1970
|
||||||
|
1970-01-15 3 1970
|
@ -0,0 +1 @@
|
|||||||
|
SELECT toDate('1970-01-01') + number AS d, toISOWeek(d), toISOYear(d) FROM numbers(15);
|
@ -371,7 +371,7 @@ public:
|
|||||||
/// The week number 1 is the first week in year that contains 4 or more days (that's more than half).
|
/// The week number 1 is the first week in year that contains 4 or more days (that's more than half).
|
||||||
inline unsigned toISOWeek(DayNum d) const
|
inline unsigned toISOWeek(DayNum d) const
|
||||||
{
|
{
|
||||||
return 1 + (toFirstDayNumOfWeek(d) - toFirstDayNumOfISOYear(d)) / 7;
|
return 1 + DayNum(toFirstDayNumOfWeek(d) - toFirstDayNumOfISOYear(d)) / 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned toISOWeek(time_t t) const
|
inline unsigned toISOWeek(time_t t) const
|
||||||
|
Loading…
Reference in New Issue
Block a user