On May 13, Harry Putnam said:

>Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes:
>
>> On May 13, Harry Putnam said:
>>
>>>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
>>
>> You can use the standard (i.e. comes with Perl) POSIX module.  It has a
>> strftime() function that behaves like C's does.  Read the man page for
>> strftime and you'll have a pretty good idea how to use POSIX::strftime().
>>
>>   use POSIX 'strftime';
>>
>>   my $date = strftime "format string", localtime;
>
>My question was regarding getting dates in past...  Maybe I'm
>overlooking something obvious but a cruise thru `man strftime' hasn't
>unearthed a method to get past dates like gnu `date -d' can do.

I'm sorry, I misread the question.  I thought you were asking about the
FORMATTING of the date (the %m%d%Y_%T part) not the time travel part. ;)

Date::Manip is A+ for that.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to