Skip Menu |

This queue is for tickets about the TimeDate CPAN distribution.

Report information
The Basics
Id: 14497
Status: resolved
Priority: 0/
Queue: TimeDate

People
Owner: Nobody in particular
Requestors: bugfinder [...] rainerrose.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Can't parse Format like: Thu Sep 1 10:07:00 2005
Hi! I hope I'm at the right place. I want to report a bug in Date::Parse. $VERSION = "2.27"; written by Graham Barr OS is Debian sarge. perl, v5.8.4 built for i386-linux-thread-multi Kernel: 2.6.7-1-386 I grep the modification Date from a pdf-File like 1 #!/bin/bash 2 DATE=`pdfinfo foo.pdf | grep "ModDate:"` 3 NAME=`~/bin/mydatef.pl $DATE` Result is: ModDate: Thu Sep 1 10:07:00 2005 1 #!/usr/local/bin/perl 2 my $p; 3 4 for (my $i=1;$i<scalar(@ARGV)-1;$i++){$p.=$ARGV[$i]." ";}; 5 6 use Date::Parse; 7 # ModDate: Thu Sep 1 10:07:00 2005 8 $time = str2time($p); 9 ($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($p); 10 print "($ss,$mm,$hh,date=$day,month=$month,year=$year,z=$zone)\n"; Result is: (00,07,10,d=1,m=8,y=,z=) So I can't get month (or I have to increase the month), but the year is lost. Ok, that is't listened in the EXAMPLE DATES-Section in the documentation, but perhaps it can be build in. Sorry about my horrible grammar. Greetings, Rainer
Date: Thu, 8 Sep 2005 15:52:00 -0500 (CDT)
Subject: Re: [cpan #14497] Can't parse Format like: Thu Sep 1 10:07:00 2005
From: "Graham Barr" <gbarr [...] pobox.com>
To: bug-TimeDate [...] rt.cpan.org
RT-Send-Cc:
On Wed, September 7, 2005 10:53 am, Guest via RT wrote: Show quoted text
> Result is: > (00,07,10,d=1,m=8,y=,z=) > So I can't get month (or I have to increase the month),
The result is what is needed to pass to localtime, so month is zero-based Show quoted text
> but the year is > lost.
This is a bug that will be fixed in the next release. You can workaround it by adding a space to the end of the string you pass in. Then you will see year=105, again this is what localtime expects as input Graham.
Date: Thu, 8 Sep 2005 16:01:40 -0500 (CDT)
Subject: Re: [cpan #14497] Can't parse Format like: Thu Sep 1 10:07:00 2005
From: "Graham Barr" <gbarr [...] pobox.com>
To: bug-TimeDate [...] rt.cpan.org
RT-Send-Cc:
On Thu, September 8, 2005 3:52 pm, Graham Barr via RT wrote: Show quoted text
> > This message about TimeDate was sent to you by gbarr@pobox.com > <gbarr@pobox.com> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=14497 > > > On Wed, September 7, 2005 10:53 am, Guest via RT wrote: > >
>> Result is: >> (00,07,10,d=1,m=8,y=,z=) >> So I can't get month (or I have to increase the month),
> > The result is what is needed to pass to localtime, so month is zero-based >
>> but the year is >> lost.
> > > This is a bug that will be fixed in the next release. > > You can workaround it by adding a space to the end of the string you pass > in. Then you will see year=105, again this is what localtime expects as > input
Correction. This is a bug in your test for (my $i=1;$i<scalar(@ARGV)-1;$i++){$p.=$ARGV[$i]." ";}; warn "-$p-"; perl script Thu Sep 1 10:07:00 2005 -Sep 1 10:07:00 - Fix you for loop, or just hard code the date in the script with my $p = "Thu Sep 1 10:07:00 2005"; And then the date is parsed correctly Graham.