full version solutions
use pip install Python arrow
package
$ pip install -U arrow
- use Python
REPL
$ python
>>> import arrow
>>> from datetime import datetime
>>> now = arrow.get(datetime.now(), 'Asia/Shanghai')
>>> print("now =", now)
>>> now = 2023-04-13T00:01:45.222910+08:00
>>> quit()
- run
test.py
as a shell script
$ touch test.py
$ vim ./test.py
$ chmod +x ./test.py
# now = 2023-04-13T00:01:45.222910+08:00
test.py
#!/usr/bin/env python3
# coding: utf8
import arrow
from datetime import datetime
# ✅
now = arrow.get(datetime.now(), 'Asia/Shanghai')
print("now =", now)
# ❌
# arrow.get(datetime.now(), 'zh-cn')
screenshots


refs
https://arrow.readthedocs.io/en/latest/