Re: Date function
- From: "K.J. 44" <Holleran.Kevin@xxxxxxxxx>
- Date: 28 Nov 2006 14:08:11 -0800
I will try that. Thank you!
Sharif Islam wrote:
K.J. 44 wrote:
Hi,
is there a date function in Perl or do I have to try to find a module?
What i need is to be able to come up with the current date, then
subtract one day, and add that to the file name in the form of:
YYYY-MM-DD-RestOfFileName.txt
The script I have written parses these files and I want to run it every
night after midnight on the previous days file which has the naming
convention above.
I am running ActiveState Perl in a Windows environment.
You can use the Date::Format module.
use strict
use Date::Format;
my $yesterday = time() - ( 24 * 60 * 60 );
my $prefix= time2str("%Y-%m-%d", $yesterday);
# YYYY-MM-DD-RestOfFileName.txt
print $prefix."-RestOfFileName.txt"
.
- References:
- Date function
- From: K.J. 44
- Re: Date function
- From: Sharif Islam
- Date function
- Prev by Date: Re: Date function
- Next by Date: Re: Perl/Mail Suggestion....
- Previous by thread: Re: Date function
- Next by thread: Re: Date function
- Index(es):
Relevant Pages
|