On Jul 24, shweta shah said: >is there something in perl through which i can get >date previous to some specified days ,say 20 days befores date >i need to know only dd-mm-yy and not time >is there any module function for it Apart from what others have said, you can't JUST take the localtime() of time - 20 * 86400: $n = time; $t = $n - 20 * 86400; $now = localtime($n); $then = localtime($t); That will fail in some cases, where daylight savings time comes on or off. To safely do this math, you should get the time for today at NOON. use Time::Local; $n = timelocal(0,0,12, (localtime)[3,4,5]); # noon, today $t = $n - 20 * 86400; $now = localtime($n); $then = localtime($t); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun. Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** Manning Publications, Co, is publishing my Perl Regex book ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to get date before say 20 days ?
Jeff 'japhy/Marillion' Pinyan Tue, 24 Jul 2001 09:07:20 -0700
- how to get date before say 20 days ? shweta shah
- RE: how to get date before say 20 days ... Steve Howard
- Re: how to get date before say 20 days ... Luke Bakken
- RE: how to get date before say 20 days ... Jeff 'japhy/Marillion' Pinyan
- RE: how to get date before say 20 days ... Sascha Kersken
- Re: how to get date before say 20 days ... Craig Moynes/Markham/IBM