bazz
03-09-2009, 01:17 AM
Hi,
OK I have totally confused myself so I can't see a way out of this.
I have a script which takes a timestamp and gets the day of week from it.
my$day_number = get_day_number($timestamp);
sub get_day_number {
my $day_number = shift;
return time2str("%w",$day_number);
}
seems fine.
However, that uses numbers 0-6.
When I read from the stored values of 0-6, this code tells me that I am out of range for the 0's.
my $day_start = $lp->{day_start};
my $formatted_day_start = Day_of_Week_to_Text($day_start);
Both codes work but the problem is that one uses 1-7 and the other uses 0-6.
How can I make the first block of code use the range of 1-7.
bazz
OK I have totally confused myself so I can't see a way out of this.
I have a script which takes a timestamp and gets the day of week from it.
my$day_number = get_day_number($timestamp);
sub get_day_number {
my $day_number = shift;
return time2str("%w",$day_number);
}
seems fine.
However, that uses numbers 0-6.
When I read from the stored values of 0-6, this code tells me that I am out of range for the 0's.
my $day_start = $lp->{day_start};
my $formatted_day_start = Day_of_Week_to_Text($day_start);
Both codes work but the problem is that one uses 1-7 and the other uses 0-6.
How can I make the first block of code use the range of 1-7.
bazz