epoch->calendar date(1) wizardry

markzero mark at darklogik.org
Sun May 29 19:48:29 PDT 2005


> > 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
> > 
> > ..and I want to print it in a standard UK format, such as:
> > 
> >   +%H:%M:%S %d/%m/%y
> 
> date -r $(cat t) +"%H:%M:%S %d/%m/%y"

Oh my, it's really that simple? I think I must have tried just about
everything ELSE as my twenty minutes of

  Failed conversion of ``1117417465'' using format ``%H:%M:%S %d/%m/%y''
  date: illegal time format

...suggest.

02:44:25 30/05/05

Thank you!

-- 
PGP: http://www.darklogik.org/pub/pgp/pgp.txt
B776 43DC 8A5D EAF9 2126 9A67 A7DA 390F DEFF 9DD1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 825 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050530/166bcc68/attachment.bin


More information about the freebsd-questions mailing list