Subject: Re: date feature request
To: None <netbsd-users@netbsd.org>
From: George Georgalis <george@galis.org>
List: netbsd-users
Date: 11/14/2006 14:10:53
On Tue, Nov 14, 2006 at 04:25:08PM +0100, Christian Biere wrote:
>matthew sporleder wrote:
>> You can also do most of this stuff portably with awk.
>> Here's an easy example of yesterday: (tested on netbsd and solaris)
>> 
>> echo|awk 'BEGIN { d = systime() - 86400; } END { print strftime("%c", d) }'
>
>You can do the same with "date -r $timestamp +$format" and you can calculate
>using $(()) in a Bourne shell but I think he wanted to parse dates in different
>formats, not just print them.

Yes, exactly. Though I'm very glad to hear that awk supports
strftime. The task at hand is translating human enterable
timestamps (ie [[[[[cc]yy]mm]dd]hh]mm[.ss]) into unix seconds (the
internal format for a db).

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><