epoch->calendar date(1) wizardry

Giorgos Keramidas keramida at ceid.upatras.gr
Mon May 30 03:32:59 PDT 2005


On 2005-05-30 03:35, markzero <mark at darklogik.org> wrote:
> Hello,
> How may one pretty print an epoch timestamp using date(1)? The date
> manual page gives me a headache.
>
> Essentially, I have the timestamp in a file:
>
> $ cat t
> 1117417465

	$ date -j -f '%s' 1117417465 '+%Y/%m/%d %T %z'
	2005/05/30 04:44:25 +0300

The -j and -f options, when combined together, can help you convert
practically any format that strptime(3) can read and parse to any time
strftime(3) can print.



More information about the freebsd-questions mailing list