Time
Run the date command to get the current time. If the user gives a timezone argument, convert it and pass it via TZ.
No argument (machine's local time)
date
Argument given
Accept two input styles:
- UTC offset, e.g.
utc+7,UTC-5,gmt+8- Parse the sign and number (e.g.
+7,-5) - Map to POSIX
Etc/GMTzones — note the sign is inverted:UTC+7→Etc/GMT-7,UTC-5→Etc/GMT+5
- Parse the sign and number (e.g.
TZ='Etc/GMT-7' date # for utc+7
- IANA timezone name, e.g.
Asia/Bangkok,America/New_York
TZ='Asia/Bangkok' date
Report the result clearly, including day, date, time, and the timezone used (state it explicitly since it may differ from the machine's local time).