Sample Header Ad - 728x90

Locale: Unable to get correct date (for Sunday of this week)

2 votes
1 answer
197 views
- I did the following yesterday night (before midnight of Sunday in Germany): - Today's date
$ LC_TIME="en.GB.UTF8" date --iso-8601
2025-01-12
- Today's date (day of the week
$ LC_TIME="en.GB.UTF8" date +%u
7

$ LC_TIME="en.GB.UTF8" date +%a
Sun
# Issue - Since, week starts from Monday to Sunday, this week Monday should be 2025-01-06
bash
$ LC_TIME="en_GB.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_IE.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_IN.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_US.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_DE.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_JP.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_DK.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_CA.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
bash
$ LC_TIME="en_AU.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
# Another observation I did this today on 2025-01-13 (in Germany)
$ LC_TIME="en_AU.UTF-8" date -d "this-week-sunday" --iso-8601
2025-01-19
$ LC_TIME="en_AU.UTF-8" date -d "last-week-sunday" --iso-8601
2025-01-12
$ LC_TIME="en_AU.UTF-8" date -d "next-week-sunday" --iso-8601
2025-01-26
# Issue So, today it seems to be giving partly correct results. What is wrong from today's output: if from yesterday's output this-week-monday was 2025-01-13 so somehow computer was counting Sunday as the first day of the week in every locale (that I showed above). So then "this-week-sunday" should be yesterday and not 2025-01-19 (as shown today). # Summary **Yesterday**
bash
$ LC_TIME="en_GB.UTF-8" date -d "this-week-monday" --iso-8601
2025-01-13
**Today**
env -i bash --norc --noprofile
bash-5.2$ LC_TIME="en_AU.UTF-8" date -d "this-week-sunday" --iso-8601
2025-01-19
**Issue**: So if yesterday (2025-01-12, Sunday), this-week-monday was 13th then, today this-week-sunday should be yesterday and not 2025-01-19 **Why am I getting the wrong date output?**
Asked by Porcupine (2156 rep)
Jan 13, 2025, 06:29 AM
Last activity: Jan 13, 2025, 11:22 AM