You could use this (untested):
# specify which day of week
$recurrence = DateTime::Event::Recurrence->weekly(
days => '7' );
# specify the start and end dates
$now = DateTime->now;
$span = DateTime::Span->from_datetimes(
start => $now->truncate( to => 'month' ),
end
> First: How many of a particular DOW are in a
> period. This is just a matter of dividing the
> total days by seven then adding one if
> needed. If a function were added for this,
> then I imagine its more a part of
> DateTime::Span rather than DateTime itself.
I already said this. :)
> Secondly
Jerry Wilcox <[EMAIL PROTECTED]> wrote:
> I'm not sure about the count in a year, but
I frequently need to
> determine how many of a given day of the
week fall in a given month
> of the year, or, more precisely, given that
today is Saturday,
> September 20, I need to figure out whether
today is
On 9/20/03 Joshua Hoblitt wrote:
>> I'm not sure about the count in a year, but I frequently need to
>> determine how many of a given day of the week fall in a given month
>> of the year, or, more precisely, given that today is Saturday,
>> September 20, I need to figure out whether today is the f
> I'm not sure about the count in a year, but I frequently need to
> determine how many of a given day of the week fall in a given month
> of the year, or, more precisely, given that today is Saturday,
> September 20, I need to figure out whether today is the first,
> second, third, fourth, or fift
At 11:40 PM -0500 9/19/03, Dave Rolsky wrote:
DateTime->day_count_in_year( year => 1999, day => 4 );
I think this is what was originally meant.
What would people need this info for?
I'm not sure about the count in a year, but I frequently need to
determine how many of a given day of the week f
On Sat, 20 Sep 2003, Syamala Tadigadapa wrote:
> Even in the datetime project code, may be you can add a method to supply the
> weekday of jan_first of present year if desired useful. May be a method can
$dt->clone->truncate( to => 'year' )->day_of_week
I don't think that justifies a new method
From: "Hill, Ronald" <[EMAIL PROTECTED]>
To: 'Syamala Tadigadapa' <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: RE: figuring out the number of sundays in a given year
Date: Thu, 18 Sep 2003 11:30:15 -0700
Hi Syamala,
> Here is a simple solution (unle
On Fri, 19 Sep 2003, Joshua Hoblitt wrote:
> > The day_of_week() method DOES NOT TAKE ARGUMENTS!
>
> I wonder if it's worth the overhead of checking for extraneous
> parameters on all methods?
I'd rather try to keep accessors as quick as possible.
-dave
/*===
House Absolute
> The day_of_week() method DOES NOT TAKE ARGUMENTS!
I wonder if it's worth the overhead of checking for extraneous parameters on all
methods?
-J
--
On Wed, 17 Sep 2003, Ron Hill wrote:
> Ok, I see I can just do
> my $dow = $dt2->day_of_week(
> year => $dt->year,
> );
The day_of_week() method DOES NOT TAKE ARGUMENTS!
I don't know what you think the code above does, but I can tell you that
all it does is return the day of
Syamala Tadigadapa wrote:
> Here is a simple solution
... I'd hate to see your complex solution ...
Rick
Hi Dave & Josh,
"Dave Rolsky" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wed, 17 Sep 2003, Hill, Ronald wrote:
>
[snipped]
>
> Josh is confused because you're passing arguments to the day_of_week
> method. These arguments are completely ignored by DateTime.pm!
>
>
> -dave
O
Hill, Ronald wrote:
>
> > sub jan1{
> > my $y = shift;
> > my $m = 1; $d = 1;
> ^^
> why is that there? and I don't understand why you set $m to 1
> and then set it to 11?
>
> > $m = 11; $y--;
> > my $c = int($y / 100); $yy = $y %100;
> > my $z = ( 1 + $yy + int($yy/4) + i
Hi Syamala,
> Here is a simple solution (unless you are bent on doing
> it in a longer way using the class in ref.)
The project I have started on is using DateTime for other things, so I
figured I would use it here as well. Besides I don't think what I
wrote is doing it the long way, granted
On Thu, 18 Sep 2003, Syamala Tadigadapa wrote:
> Here is a simple solution (unless you are bent on doing it in a longer way
> using a date time class.)
Yeah, because letting others do the repeated work for you would be silly.
> sub jan1{
> my $y = shift;
> my $m = 1; $d = 1;
> $m = 11; $
Here is a simple solution (unless you are bent on doing it in a longer way
using a date time class.)
sub jan1{
my $y = shift;
my $m = 1; $d = 1;
$m = 11; $y--;
my $c = int($y / 100); $yy = $y %100;
my $z = ( 1 + $yy + int($yy/4) + int($c/4) - 2*$c) % 7;
$z += 7 if $z < 0;
return $z; #
On Wed, 17 Sep 2003, Hill, Ronald wrote:
> I checked the docs for datetime and used them
> F:\scripts>perldoc DateTime|grep day_of_week
> File STDIN:
> $dow= $dt->day_of_week; # 1-7 (Monday is 1) - also dow, wday
> "_0". So for example, this class provides both "day_of_week()" and
Hi Josh,
>
> Hi Ron,
>
> I'm a bit confused by your parameters to day_of_week().
>
> This is the actual implementation from DateTime.pm
>
> sub day_of_week { $_[0]->{local_c}{day_of_week} }
>
> -J
>
I compute the number of days in the current year
I figure out the day of week for janua
Hi Ron,
I'm a bit confused by your parameters to day_of_week().
This is the actual implementation from DateTime.pm
sub day_of_week { $_[0]->{local_c}{day_of_week} }
-J
--
> script=
>
> use strict;
> use warnings;
> use DateTime;
>
> my $dt =
20 matches
Mail list logo