The parse_datetime routine in DateTime::Format::Excel is 100% when
converting dates from the Excel serial date format, but I found it
doesn't convert the time portion of a value, i.e. the decimal portion of
the float. For example, the following code:
my $datetime =
At a high level, recurring and single events don't have to have
different properties IMO, depending on how you structure the series of
event references. If you separate the event information from the
scheduling, having an array, hash, whatever of scheduled events would
simply hold references to
I thought the first solution posted to your use Perl article was decent:
sub partition {
my ($start, $end, $n) = @_;
my $s = $start-epoch;
my $e = $end-epoch;
my $i = int( ($e - $s) / $n );# interval
return map DateTime-from_epoch(epoch = $s + $i * $_), 0 .. $n;
}
But I
Good info on using a Set. I meant to look at that after looking at the
FAQ but wasn't familiar with using them and didn't want to waste too
much time.
Hiding the rounding error by replacing the last value with $end itself
was the solution in my second sub-routine, but it might not have been
If you installed the module to your system's default Perl install, it
should be found automatically by the use statement.
use DateTime;
If it's not found, then I'm guessing that you may have more than one
Perl install (assuming Unix) and the default Perl install, i.e. the
one occurs first in
Whoops, spellcheck got me. 'which Perl' should have been 'which perl'.
Bobby
-Original Message-
From: Metz, Bobby [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 30, 2007 11:49 AM
To: Robert A. Rawlinson; datetime@perl.org
Subject: RE: Problem with TimeZone.pm
If you installed
Check out the Basic Usage section of the DateTime FAQ. The How can I
get a string representing a date? section likely shows you everything
you need.
http://datetime.perl.org/index.cgi?FAQBasicUsage
Bobby
-Original Message-
From: Brian Hirt [mailto:[EMAIL PROTECTED]
Sent: Thursday, May
Don't see this behavior on my system...
perl -MPOSIX -le 'print scalar
localtime(mktime(0,0,2+24,4,9,108,0,0,-1))'
Sun Oct 5 02:00:00 2008
perl -MPOSIX -le 'print scalar
localtime(mktime(0,0,2+25,4,9,108,0,0,-1))'
Sun Oct 5 03:00:00 2008
I ran all of your examples and the times always agree
I think the key to Perrin's issue is documented on the DateTime
page, even though these functions were not referenced in the two posts:
+ years, months, weeks, days, hours, minutes, seconds, nanoseconds
These methods return numbers indicating how many of the given unit the
object
Jim,
You don't need to write your own module to handle these. Just use the
DateTime::Format::Strptime module. Modify the parser example below with a
pattern to suit your own format. $dt will hold your new datetime object with
the values parsed from your string format.
my $parser =
source or storage
requirements.
Bobby
-Original Message-
From: Rick Measham [mailto:ri...@isite.net.au]
Sent: Tuesday, March 17, 2009 6:34 PM
To: jim.mo...@yahoo.com
Cc: datetime@perl.org
Subject: Re: Module To Parse Format 'Friday, March 13, 2009 04:20 PM EST'
Metz, Bobby wrote
Zefram wrote:
Shane McCarron wrote:
Wow - sounds like a bug to me. Ick.
A bug in what, though? DateTime-today is documented to behave like a
truncate-to-day operation, which implies setting to 00:00 local time.
Do you want to change the semantics of truncate? Or make -today
Dave,
I'm not sure I understood your last post. Did you mean that those
strftime methods only found in DateTime::Locale::Base are going away? Or did
you mean that strftime methods in DateTime proper are being deprecated and
removed? If yes to the later, is DateTime::Format::Strptime
All,
I'm sorry all to reply to my own post. I should have read the original
message first before replying to Dave's message. I see that the module I'm
questioning is at the root of the issue, so my apologies again.
As someone who uses DateTime::Format::Strptime quite a bit,
Ronald,
Do you run the script via cron? If so, do you only see the timezone
error when running it via cron and not when running manually? If yes to both,
then I'd wager the routine you referenced is impacted by the shell path not
being the same for cron as for your login session. I
Ugh, I need more caffeine today it seems. Ignore my idiotic path comment.
Question of cron vs. non-cron still applies though? If nothing else but to
narrow the conditions under which your issue is occurring.
Bobby
-Original Message-
From: Metz, Bobby
Sent: Tuesday, November 03
I like the new option idea Kevin proposes. Seems more straightforward.
Just my 2 cents...
B
-Original Message-
From: Kevin McGrath [mailto:kmcgr...@baknet.com]
Sent: Tuesday, December 15, 2009 2:23 PM
To: Evan Carroll
Cc: datetime@perl.org
Subject: Re: time_zone and
-Original Message-
From: Karen Etheridge [mailto:p...@froods.org]
Sent: Monday, August 23, 2010 1:42 PM
Totally off-topic, but this reminded me of a book I recently completed,
Martian Rainbow by Robert L. Forward, which spelled out the details of
a functional Martian calendar that
You can add the current year to your string value prior to parsing.
my $val = Sep 1 05:39:02;
# Grab the year either via exec or via DateTime, your choice
chomp(my $year = `date '+%Y'`);
# --or--
my $year = strftime('%Y',localtime(time));
# Then combine and parse the string value into a DT
On Thu, Sep 02, 2010 at 01:24:03PM -0400, Metz, Bobby wrote:
You can add the current year to your string value prior to parsing.
Thanks. I'll adopt the DateTime based version in your second mail.
You're welcome.
Of course you could also alter you syslog config to include the year
Philip,
I'm just trying to understand your problem a bit more, so bear with me.
First, I think the trouble is that you technically can't have a date without a
month and day value, so storing them as undef wouldn't work well, at least not
without sacrificing DateTime math and impacting
From: Zefram [mailto:zef...@fysh.org]
The form of epoch seconds implemented by DateTime doesn't count
leap seconds. So in the time scale supplied by DateTime it is *not*
I wasn't aware of the bit about epoch Zefram pointed out. Can someone answer
this related hypothetical for me?
1. You
I don't use this module, but check the docs on the as_list() method. The
config example (copied below) should give you an idea on how to get the # of
objects without the addition of any special methods required.
my @dt_span = $set-as_list( span = $span );
Bobby
From: Andreas Isberg
23 matches
Mail list logo