Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: Carl.YamamotoFurst [...] mlb.com
Cc:
AdminCc:

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



Subject: sedate doesn't set a date for printf?
Date: Wed, 24 Feb 2016 18:00:51 +0000
To: "bug-Date-Manip [...] rt.cpan.org" <bug-Date-Manip [...] rt.cpan.org>
From: "Furst, Carl" <Carl.YamamotoFurst [...] mlb.com>
Hello, I’m working on a mac using OS X 10.10.5 using perl 5.18.2 and I just installed Date::Manip 6.52 I’ve been reading the config documentation and noticed that there is a way in the SetDate config docs to set the date/time for a different time zone as follows: $date->config("setdate","now,ZONE”); So If I do this as follows it should parse ‘now’ in the specified ZONE. However when I do the following my $date = new Date::Manip::Date; $date->config("setdate", “now,gmt”); And then printf: $date->printf(“%Y%m%dT%H:%M:%S”) I get the following error: WARNING: [printf] Object must contain a valid date And no date… Should this be setting the date to ‘now’ in GMT?? Thanks, Carl Yamamoto-Furst -- ********************************************************** MLB.com - Where Baseball is Always On
I'm afraid you've misunderstood what the setdate config variable does. In your case, it's just saying that whatever time it is now, just pretend it's in a different timezone. That doesn't set a date associated with the Date::Manip::Date object however. If you add: $date->parse("now"); before the printf, that will stick a date in the object, and you should get what you want.
Subject: Re: [rt.cpan.org #112372] sedate doesn't set a date for printf?
Date: Wed, 24 Feb 2016 22:16:16 +0000
To: "bug-Date-Manip [...] rt.cpan.org" <bug-Date-Manip [...] rt.cpan.org>, "Furst, Carl" <Carl.YamamotoFurst [...] mlb.com>
From: "Furst, Carl" <Carl.YamamotoFurst [...] mlb.com>
Mr. Beck, Thanks for getting back to me so soon! I¹m afraid that¹s not what I have found. I¹m probably doing something wrong: BAM-035034-CF:PerlScripts furst$ perl -MDate::Manip::Date my $date = new Date::Manip::Date; $date->config("setdate", "now,gmt"); $date->parse("now"); print $date->printf("%Y%m%dT%H:%M:%S"); 20160224T17:10:42 <‹ EST BAM-035034-CF:PerlScripts furst$ date Wed Feb 24 17:10:51 EST 2016 <‹ Perhaps I need to parse ³now² first?? Carl Yamamoto-Furst Cms Engineer Carl.YamamotoFurst@mlb.com p: 212-485-4502 aim: furstmlb -- On 2/24/16, 4:09 PM, "Sullivan Beck via RT" <bug-Date-Manip@rt.cpan.org> wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=112372 > > >I'm afraid you've misunderstood what the setdate config variable does. > >In your case, it's just saying that whatever time it is now, just pretend >it's in a different timezone. > >That doesn't set a date associated with the Date::Manip::Date object >however. > >If you add: > > $date->parse("now"); > >before the printf, that will stick a date in the object, and you should >get what you want. > >
********************************************************** MLB.com - Where Baseball is Always On
You got the right result. The config option "setdate now,gmt" means that whatever time it is "now" is interpreted as being in GMT rather than in the local timezone. So if it is currently: 07:30:45 in the current timezone which (in my case) is EST, then after setting this option, then parsing the time "now", it will still show 07:30:45, but it will be in GMT instead of EST. That's what you got. If you would have added a %Z to your printf format, you'd have seen that the timezone of the date was GMT rather than your local time zone.
Subject: Re: [rt.cpan.org #112372] sedate doesn't set a date for printf?
Date: Thu, 25 Feb 2016 16:56:19 +0000
To: "bug-Date-Manip [...] rt.cpan.org" <bug-Date-Manip [...] rt.cpan.org>
From: "Furst, Carl" <Carl.YamamotoFurst [...] mlb.com>
Got it! Thank you! Carl Yamamoto-Furst -- On 2/25/16, 7:27 AM, "Sullivan Beck via RT" <bug-Date-Manip@rt.cpan.org> wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=112372 > > >You got the right result. > >The config option "setdate now,gmt" means that whatever time it is "now" >is interpreted as being in GMT rather than in the local timezone. > >So if it is currently: > 07:30:45 >in the current timezone which (in my case) is EST, then after setting >this option, then parsing the time "now", it will still show 07:30:45, >but it will be in GMT instead of EST. > >That's what you got. > >If you would have added a %Z to your printf format, you'd have seen that >the timezone of the date was GMT rather than your local time zone. > >
********************************************************** MLB.com - Where Baseball is Always On