home ~ projects ~ socials

Basic Command Line Date/Timestamp Examples

Epoch Seconds

date +%s

Timezone

date +%z

Timezone without newline

printf "%s" $(date +%z)

Timestamp Variable

#!/bin/bash

TIMESTAMP=$(date +%Y-%m-%dT%H:%M:%S)

echo $TIMESTAMP
Output:
2017-09-08T09:51:04
-- end of line --