date

date

Usage

Basic usage

See man date

Simplest use:

$ date "+%Y"
2016

within scripts

To date-stamp or time-stamp your files, the following may be useful within scripts:

date +%F          # yyyy-mm-dd, e.g 2016-02-10
date +%H-%M-%S    # hh-mm-ss, e.g. 15-26-10
date +%F-%H-%M-%S # Combines the two above.
date +%s          # Unix timestamp, e.g. 1455089288
date +%s.%N       # If necessary, add nanoseconds, e.g. 1455089359.711595818.

Format

Syndicate content