Added getDayOfWeek function which returns the numeric day of the week (1=Monday, 2=Tuesday, etc)
This commit is contained in:
parent
4decfcd738
commit
92626f43af
1 changed files with 20 additions and 0 deletions
|
|
@ -357,6 +357,26 @@ sub getDayName {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDayOfWeek ( epoch) {
|
||||
|
||||
Returns the position (1 - 7) of the day of the week of the epoch passed in. 1 is Monday, 2 is Tuesday, etc
|
||||
|
||||
=head3 epoch
|
||||
|
||||
An epoch date.
|
||||
|
||||
=cut
|
||||
|
||||
sub getDayOfWeek {
|
||||
my $self = shift;
|
||||
my $dt = DateTime->from_epoch( epoch => shift );
|
||||
$dt->set_time_zone($self->session->user->profileField("timeZone")|| "America/Chicago"); # assign the user's timezone
|
||||
return $dt->day_of_week;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDaysInMonth ( epoch )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue