2 # Desc: Baltakatei's verbose date command
3 # Usage: bkdatev [args]
4 # Example: bkdatev --date="2001-09-11T09:02:59-04"
6 # Ref/Attrib: [1] "ISO 8601". Wikipedia. https://en.wikipedia.org/wiki/ISO_8601
7 # [2] "Changing the Locale in Wine" https://stackoverflow.com/a/16428951
8 # [3] "Shanghai vs Beijing" https://bugs.launchpad.net/ubuntu/+source/libgweather/+bug/228554
9 # Notes: * Check `ls -R /usr/share/zoneinfo` for time zone names.
10 # * Check `cat /usr/share/i18n/SUPPORTED` for supported locales.
11 # * For list of valid locales, see: https://manpages.ubuntu.com/manpages/bionic/man3/DateTime::Locale::Catalog.3pm.html
12 # * Locations chosen for population, personal signifiance, and spatial coverage.
13 # * For International Atomic Time (TAI), use offsets from UTC provided in `/usr/share/zoneinfo/leap-seconds.list`.
19 if ! ((n_ln
% "$skip_every")); then
23 }; # periodically print separating blank line
31 # Depends: printf, date
32 # Ref/Attrib: * Truncate string in printf https://stackoverflow.com/a/46812677
33 local s_1 s_2 s_3 s_4
;
36 s_2
="$(date "$@
" "$fs_1")";
37 s_3
="$(date "$@
" "$fs_2")";
38 s_4
="$(date "$@
" "$fs_3")";
40 printf "%-10.10s %-25.25s (%-20.20s) (%s)" "$s_1" "$s_2" "$s_3" "$s_4";
43 unset fs_1 fs_2 fs_3 fs_4
;
44 }; # print line of dates
46 n_ln
=0; # for line_sep()
47 unset LC_TIME
; # Fall back to time zone-specific locale settings.
50 fs_iso8601
="+%Y-%m-%dT%H:%M:%S%:::z"; # typical ISO-8601
51 fs_iso8601_etc
="+%G-W%V-%u, %Y-%j"; # alternate ISO-8601 dates
52 fs_locale
="+%Z; %A; %c"; # locale-specific date strings
54 # vars for print_dateline()
56 fs_2
="$fs_iso8601_etc";
59 # UTC (pop. (2021): 7,837,000,000)
63 fs_3
="+%s seconds since 1970-01-01T00:00+00";
70 export LANG
="haw-US.UTF8";
77 export TZ
=America
/Los_Angeles
;
78 export LANG
="en_US.UTF-8";
83 # Denver, USA (pop. (2021): 711,463)
85 export TZ
=America
/Denver
;
86 export LANG
="en_US.UTF-8";
91 # Chicago, USA (pop. (2021): 711,463)
93 export TZ
=America
/Chicago
;
94 export LANG
="en_US.UTF-8";
99 # Mexico City, Mexico (pop. (2018): 21,804,515)
101 export TZ
=America
/Mexico_City
;
102 export LANG
="es_MX.UTF8";
107 # Panama City, Panama
109 export TZ
=America
/Panama
;
110 export LANG
="es_PA.UTF8";
115 # New York, USA (pop. (2018): 20,140,470)
117 export TZ
=America
/New_York
;
118 export LANG
="en_US.UTF-8";
125 export TZ
=America
/Sao_Paulo
;
126 export LANG
="pt_BR.UTF8";
133 export TZ
=America
/Argentina
/Buenos_Aires
;
134 export LANG
="es_AR.UTF8";
141 export TZ
=Europe
/London
;
142 export LANG
="en_GB.UTF-8";
149 export TZ
=Africa
/Kinshasa
;
150 export LANG
="ln_CD.UTF8";
157 export TZ
=Africa
/Lagos
;
158 export LANG
="en_NG.UTF8";
165 export TZ
=Europe
/Paris
;
166 export LANG
="fr_FR.UTF8";
173 export TZ
=Europe
/Stockholm
;
174 export LANG
="sv_SE.UTF8";
181 export TZ
=Africa
/Cairo
;
182 export LANG
="ar_EG.UTF8";
187 # Athens (pop. (2020): 3,526,887)
189 export TZ
=Europe
/Athens
;
190 export LANG
="el_GR.UTF8";
195 # Istanbul (pop. (2020): 13,719,061)
197 export TZ
=Asia
/Istanbul
;
198 export LANG
="tr_TR.UTF8";
205 export TZ
=Asia
/Tehran
;
206 export LANG
="fa_IR.UTF8";
213 export TZ
=Europe
/Moscow
;
214 export LANG
="ru_RU.UTF-8";
219 # Kyiv, Ukraine (pop. (2021): 2,962,180)
221 export TZ
=Europe
/Kyiv
;
222 export LANG
="uk_UA.UTF-8";
227 # Delhi, India (pop. (2018): 29,000,000)
229 export TZ
=Asia
/Kolkata
;
230 export LANG
="hi_IN.UTF-8";
235 # Jakarta, Indonesia (pop. (2018): 33,430,285)
237 export TZ
=Asia
/Jakarta
;
238 export LANG
="id_ID.UTF8";
243 # Singapore, Singapore (pop (2018): 5,792,000)
245 export TZ
=Asia
/Singapore
;
246 export LANG
="en_SG.UTF-8";
251 # Beijing, China (pop. (2018): 19,618,000)
253 export TZ
=Asia
/Shanghai
; # [3]
254 export LANG
="zh_CN.UTF-8";
259 # Taipei, Taiwan (pop (2019): 7,034,084)
261 export TZ
=Asia
/Taipei
; # [3]
262 export LANG
="zh_TW.UTF-8";
267 # Tokyo, Japan (pop. (2018): 37,274,000)
269 export TZ
=Asia
/Tokyo
;
270 export LANG
="ja_JP.UTF8";
275 # Seoul, South Korea (pop. (2018): 25,514,000)
277 export TZ
=Asia
/Seoul
;
278 export LANG
="ko_KR.UTF8";
283 # Pyongyang, North Korea
285 export TZ
=Asia
/Pyongyang
;
286 export LANG
="ko_KP.UTF8";
293 export TZ
=Australia
/Sydney
;
294 export LANG
="en_AU.UTF8";
301 export TZ
=Pacific
/Guam
;
302 export LANG
="en_GU.UTF8";
307 # Auckland, New Zealand
309 export TZ
=Pacific
/Auckland
;
310 export LANG
="en_NZ.UTF8";