In the last episode (Jun 20), Gore Jarold said:
> If I have a arbitrary date/time and I want to convert
> that to epoch time, I do this with GNU date:
> 
> date --date='1970-01-01 00:02:00 +0000' +%s
>
> Easy.
> 
> Can someone tell me what the syntax is for FreeBSD
> date command ?

date -j -f '%Y-%m-%d %H:%M:%S %Z' '1970-01-01 00:02:00 GMT' +%s

Adjust the -f argument to match whatever format your input string has
(the date manpage has an example that parses date's default output back
into itself).  Unfortunately, it looks like strptime doesn't handle the
%z flag, which is why I changed your +0000 to GMT and used %Z instead. 
%z is actually easier to parse, so I'm not sure why it's not handled.

-- 
        Dan Nelson
        [EMAIL PROTECTED]
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to