On Sun, 2007-02-04 at 07:27 -0800, Tom Phoenix wrote:
> On 2/3/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
>
> > my @date = (localtime)[3..5];
> > my $day = sprintf '%02d', $date[0] - 1;
> > my $month= sprintf '%02d', $date[1] + 1;
>
> You shouldn't have to do arithmetic on the date
Mathew Snyder schreef:
> I need to make sure $day and $month are in 2-digit format
Don't mix value and presentation.
Variant-1:
perl -wle'
my $i = 0;
my ($day, $month, $year) =
map $_ + (0, 1, 1900)[$i++], (localtime)[3..5];
printf qq/%04d %02d %02d\n/, $year, $month, $day;
'
Rob Dixon wrote:
> Mathew Snyder wrote:
>> Tom Phoenix wrote:
>>> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
>>>
I'm running this as a cron job 1 minute after midnight on Saturday
nights (Sunday morning) so as to cover all of Saturday back through the
previous Sunday. Does your su
On Sun, 11 Feb 2007 03:51:17 -0500
Mathew Snyder <[EMAIL PROTECTED]> wrote:
> Jeff Pang wrote:
> >> #!/usr/bin/perl
> >>
> >> use warnings;
> >> use strict;
> >>
> >> my @date = (localtime (time - (24*60*60)))[3..5];
> >>
> >> foreach my $i (@date) {
> >>print $i . "\n";
> >> }
> >>
>
Mathew Snyder wrote:
> Tom Phoenix wrote:
>> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
>>
>>> I'm running this as a cron job 1 minute after midnight on Saturday
>>> nights (Sunday morning) so as to cover all of Saturday back through the
>>> previous Sunday. Does your suggestion mean I'd have t
>
>I need to make sure $day and $month are in 2-digit format so that wouldn't
>work.
> At least, not anyway I'm presently familiar with. I tried to use sprintf in
>there but it failed because of not enough arguments.
$day = '0' . $day if length($day) < 2;
$month = '0' . $month if length($month
Owen wrote:
> On Sun, 11 Feb 2007 03:18:00 -0500
> Mathew Snyder <[EMAIL PROTECTED]> wrote:
>
>> Tom Phoenix wrote:
>>> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
>>>
I'm running this as a cron job 1 minute after midnight on Saturday
nights (Sunday morning) so as to cover all of Saturd
On Sun, 11 Feb 2007 03:18:00 -0500
Mathew Snyder <[EMAIL PROTECTED]> wrote:
> Tom Phoenix wrote:
> > On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
> >
> >> I'm running this as a cron job 1 minute after midnight on Saturday
> >> nights (Sunday morning) so as to cover all of Saturday back through th
Jeff Pang wrote:
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> my @date = (localtime (time - (24*60*60)))[3..5];
>>
>> foreach my $i (@date) {
>>print $i . "\n";
>> }
>>
>> exit;
>>
>> I get this:
>>
>> 10
>> 1
>> 107
>>
>>
>> I still have to add 1 to the month. Is that r
>
>#!/usr/bin/perl
>
>use warnings;
>use strict;
>
>my @date = (localtime (time - (24*60*60)))[3..5];
>
>foreach my $i (@date) {
>print $i . "\n";
>}
>
>exit;
>
>I get this:
>
>10
>1
>107
>
>
>I still have to add 1 to the month. Is that right? Also, the year still needs
>to be fixed
Tom Phoenix wrote:
> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
>
>> I'm running this as a cron job 1 minute after midnight on Saturday
>> nights (Sunday morning) so as to cover all of Saturday back through the
>> previous Sunday. Does your suggestion mean I'd have to run it late
>> Sunday nigh
On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote:
I'm running this as a cron job 1 minute after midnight on Saturday
nights (Sunday morning) so as to cover all of Saturday back through the
previous Sunday. Does your suggestion mean I'd have to run it late
Sunday night in order for it to cover Saturd
I'm running this as a cron job 1 minute after midnight on Saturday
nights (Sunday morning) so as to cover all of Saturday back through the
previous Sunday. Does your suggestion mean I'd have to run it late
Sunday night in order for it to cover Saturday back to the previous
Sunday (since the timest
On 2/3/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
my @date = (localtime)[3..5];
my $day = sprintf '%02d', $date[0] - 1;
my $month= sprintf '%02d', $date[1] + 1;
You shouldn't have to do arithmetic on the date components, including
all that mess about how many days are in a month
I have a script which is supposed to query a database and compile data for every
day of the week prior to when it runs. I thought I had set it so that if the
first of a month falls in the middle of the week it would roll the month back to
the previous one after all the data for the first is gather
15 matches
Mail list logo