It's a type of Planche
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

correct_weeknumbers.sh 1.6KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. # Print out the correct week number with rollover
  3. WEEKNUM=$(printf %02d $(($(date +"%U" -d "next saturday") + $(if [ "$(date +"%A" -d "$(date +"%Y")-01-01")" == "Sunday" ]; then echo "0"; else echo "1"; fi))))
  4. echo ${WEEKNUM}
  5. #$ for year in 20{19..31}; do for month_day in "1-1" "12-25"; do for day in {0..6}; do if [ $(date -d "${year}-${month_day} + ${day} day" +"%u") == 6 ]; then echo "$(printf %02d $(($(date +"%U" -d "${year}-${month_day} + ${day} day") + $(if [ "$(date +"%A" -d "${year}-01-01")" == "Sunday" ]; then echo "0"; else echo "1"; fi)))) - $(date -d "${year}-${month_day}")"; fi; done; done; done
  6. #01 - Tue 01 Jan 2019 12:00:00 AM MST
  7. #52 - Wed 25 Dec 2019 12:00:00 AM MST
  8. #01 - Wed 01 Jan 2020 12:00:00 AM MST
  9. #52 - Fri 25 Dec 2020 12:00:00 AM MST
  10. #01 - Fri 01 Jan 2021 12:00:00 AM MST
  11. #52 - Sat 25 Dec 2021 12:00:00 AM MST
  12. #01 - Sat 01 Jan 2022 12:00:00 AM MST
  13. #53 - Sun 25 Dec 2022 12:00:00 AM MST
  14. #01 - Sun 01 Jan 2023 12:00:00 AM MST
  15. #52 - Mon 25 Dec 2023 12:00:00 AM MST
  16. #01 - Mon 01 Jan 2024 12:00:00 AM MST
  17. #52 - Wed 25 Dec 2024 12:00:00 AM MST
  18. #01 - Wed 01 Jan 2025 12:00:00 AM MST
  19. #52 - Thu 25 Dec 2025 12:00:00 AM MST
  20. #01 - Thu 01 Jan 2026 12:00:00 AM MST
  21. #52 - Fri 25 Dec 2026 12:00:00 AM MST
  22. #01 - Fri 01 Jan 2027 12:00:00 AM MST
  23. #52 - Sat 25 Dec 2027 12:00:00 AM MST
  24. #01 - Sat 01 Jan 2028 12:00:00 AM MST
  25. #53 - Mon 25 Dec 2028 12:00:00 AM MST
  26. #01 - Mon 01 Jan 2029 12:00:00 AM MST
  27. #52 - Tue 25 Dec 2029 12:00:00 AM MST
  28. #01 - Tue 01 Jan 2030 12:00:00 AM MST
  29. #52 - Wed 25 Dec 2030 12:00:00 AM MST
  30. #01 - Wed 01 Jan 2031 12:00:00 AM MST
  31. #52 - Thu 25 Dec 2031 12:00:00 AM MST