If you need parts of that date, you can split the line into pieces.
There are examples in articles
Most newer versions of date (including the one on the Power Tools
disc) will also let you set the format of the date.
To do that, type a single argument that starts with a plus (+)
and has format specification characters in it.
Check your online manual page for a list of format specification
The argument has to be all one word, so you'll usually need to put
Here's a simple example:
% date +'Today is %d %h 19%y.'
Today is 13 Dec 1996.
You'll usually use this in a shell script or
Because date can mix any other text with the dates it outputs,
you can do some surprising and useful things.
Greg Ubben uses it to construct arithmetic
expressions for performing calculations on dates.
For example, since date +%U isn't available on all systems,
the following computes the week number of the year
(Sunday as the first day) and makes it available in the Bourne shell