Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Use 'strftime' to calculate a date/time in the Past.

by Khen1950fx (Canon)
on Sep 17, 2012 at 21:35 UTC ( #994117=note: print w/replies, xml ) Need Help??


in reply to Use 'strftime' to calculate a date/time in the Past.

FWIW, I used Time::Local for a one-liner:
perl -MTime::Local=timelocal -e 'print scalar localtime timelocal qw(3 +0 40 2 15 8 2012)';
Update: to get the day, date, and time 48 days ago:
#!/usr/bin/perl -l use strict; use autodie; use warnings; use POSIX 'strftime'; use Time::Local 'timelocal'; my $days_ago = '48'; ($days_ago) = strftime("%d", gmtime( time - $days_ago * 86400 )); print scalar localtime timelocal( 30, 40, 2, $days_ago, 7, 2012, );

Replies are listed 'Best First'.
Re^2: Use 'strftime' to calculate a date/time in the Past.
by Anonymous Monk on Sep 17, 2012 at 21:42 UTC
    But you don't do date math, the thing the OP is trying to do

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994117]
help
Chatterbox?
[Corion]: ambrus: AnyEvent(::HTTP) doesn't integrate well with Prima, that's my main problem
[Corion]: There is a weirdo shim because there is a POE integration for Prima, and if you use that, you can use the POE adapter of AnyEvent. What I'd want is something transport agnostic that parses HTTP or produces HTTP output, so that the communication with ...
[Corion]: ... the socket is done by my code. Ideally that module would not be based on callbacks ;)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2016-12-07 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.