bvfnbk

Notes of bvfnbk

Software development and other stuff.

date

Jul 22, 2022
1 min read
man linux unix macOS

Name

date - display or set date and time

Examples

  • Date/Time with time zone offset (format: +hhmm):

    date +%Y-%m-%d'T'%H:%M:%s%z
    2022-07-22T10:51:14+0200
    

    or shorter

    date +%F'T'%T%z
    2022-07-22T10:51:14+0200
    
  • Date/Time with time zone offset (format +hh:mm):

    • On macOS
      TZ=Europe/Berlin date -Iseconds -r $(date +%s)
      2022-07-22T10:33:40+02:00
      
    • On Linux
      date +%F'T'%T%:z
      2022-07-22T10:33:40+02:00