Harry Putnam wrote: > Group, > > Is there a date manipulation module that does the same thing as gnu > `date -d' command? That is, given a spec string, it returns a date in > the past in user selected format. > > Like what gnu `date' would do with: > date -d '-2 weeks' +"%m%d%Y_%T" > 04292004_13:20:28 > > I've written some manipulations using `time' and `localtime' plus > `printf' but doing the above is quite a lot more complex.
Like Jeff said, POSIX::strftime will help with the formatting. For offsetting 2 weeks, you can do the simple: time - 14 * 86_400 Or, you can use something like Date::Manip which handles the '2 weeks ago' type of expressions. It has its own UnixDate function that is similar to POSIX::strftime. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>