On Sat, May 13, 2006 at 02:18:10PM -0400, Michael Marsh wrote: > Since you're doing this in a script, it presumably doesn't need to be > done in a single line. I'd start with > date -d "Feb 2, 2006" +"%s" > to get the number of seconds since the epoch for midnight on the date > specified. Then I'd do > date +"%s" > to get the same for the current time. Subtract those, and you get the > number of seconds since Feb 2, 2006. There are 86400 seconds in a > day. Divide, throw out the remainder, and you've got the number of > days since Feb 2, 2006.
That sort of work is precisely why I do it in Perl. Because then you start getting into messiness with leap years, timezones, etc., etc., etc. There's a reason that time libraries are hard to write. :-) Perl's done all the work for you; be lazy. -- Stephen R. Laniel [EMAIL PROTECTED] Cell: +(617) 308-5571 http://laniels.org/ PGP key: http://laniels.org/slaniel.key
signature.asc
Description: Digital signature