Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 62894
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: stif [...] gmx.at
Cc:
AdminCc:

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



Subject: BUG: date->set
Date: Wed, 10 Nov 2010 14:16:50 +0100
To: bug-Date-Manip [...] rt.cpan.org
From: stefan reichhard <stif [...] gmx.at>
Found on: stif@mombacho:~$ cat /etc/issue Ubuntu 10.04.1 LTS \n \l stif@mombacho:~$ uname -a Linux mombacho.xxxxxxxx.com 2.6.32-25-server #45-Ubuntu SMP Sat Oct 16 20:06:58 UTC 2010 x86_64 GNU/Linux $cur_day = $cur_day+1; $date->set("d",$cur_day); #BUG: only works with 'y' and 'm' - 's' is missing and 'd', 'h' and 'mn' are right-shifted ('d'='h', 'h'='mn', 'mn'='s') Kind Regars, Stefan

Message body is not shown because sender requested not to inline it.

Could you please include more of the code that fails. You've only provided me with two lines: $cur_day = $cur_day+1; $date->set("d",$cur_day); but that doesn't tell me what $cur_day or $date were set to before, and you say that it only works with 'y' and 'm', but I'm not sure how you determine that. Could you provide a more complete example showing what $cur_day and $date were, and the results you obtained that demonstrate the bug? Thanks
Subject: Re: [rt.cpan.org #62894] BUG: date->set
Date: Wed, 10 Nov 2010 17:45:35 +0100
To: bug-Date-Manip [...] rt.cpan.org
From: stefan reichhard <stif [...] gmx.at>
Hi, I was search for a way to get the unix time for the next couple of days at 05:00:00 (a task of countless hours for me) I found a easy way now to do so: my $date = new Date::Manip::Date; my $delta = $date->new_delta(); $date->parse("Today 05:00:00"); my $err = $delta->parse("1 day later"); $date = $date->calc($delta); my $timestamp = $date->printf('%s'); But before i was trying it with $date->set() instead of the $delta approach: my $date = new Date::Manip::Date; my ($cur_year, $cur_month, $cur_day) = ParseDate('now') =~ m/(....)(..)(..)/; $date->parse('now'); $date->set('time',['05','00','00']); $cur_day = $cur_day+2; #$cur_day is 10 / 12 $date->set("y",$cur_day); #changes year $date->set("m",$cur_day); #changes month $date->set("d",$cur_day); #changes hour $date->set("h",$cur_day); #changes minute $date->set("mn",$cur_day); #changes secounds $date->set("s",$cur_day); #changes nothing print STDERR $date->printf('%s %c')."\n"; print STDERR $cur_day."\n"; output: Mon Dec 10 12:12:12 0012 cheers, stefan On 2010-11-10 15:01, Sullivan Beck via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=62894> > > Could you please include more of the code that fails. You've only > provided me with two lines: > > $cur_day = $cur_day+1; > $date->set("d",$cur_day); > > but that doesn't tell me what $cur_day or $date were set to before, and > you say that it only works with 'y' and 'm', but I'm not sure how you > determine that. > > Could you provide a more complete example showing what $cur_day and > $date were, and the results you obtained that demonstrate the bug? > > Thanks > >
I do not get the same output as you. I get: -61758571906 Wed Dec 12 12:12:12 0012 which is correct. You didn't specify which version of Date::Manip you're using, but I suspect you have encountered some bug which was fixed in version 6.12. You may want to upgrade.