Synonymous Bosch has asked for the wisdom of the Perl Monks concerning the following question:

I ran into some strange behaviour using Date::Manip 6.40 on perl 5.12.4 in Fedora 14 and I'm wondering if anyone has any thoughts on it.

Running the following code:

#!/usr/bin/perl use strict; use Date::Manip; Date_Init("TZ=+0930"); my $localtime = "1349541878"; printf("%s:%s:%s\n", $localtime, scalar localtime( $localtime ), UnixD +ate( scalar localtime( $localtime ), qq{%Y-%m-%d %H:%M:%S} ) ); $localtime = "1362112603"; printf("%s:%s:%s\n", $localtime, scalar localtime( $localtime ), UnixD +ate( scalar localtime( $localtime ), qq{%Y-%m-%d %H:%M:%S} ) );

Returns:

WARNING: [printf] Object must contain a valid date Missing argument in printf at /tmp/time.pl line 8. 1349541878:Sun Oct 7 02:14:38 2012: 1362112603:Fri Mar 1 14:06:43 2013:2013-03-01 14:06:43

Now, that's a real time zone (Australian Central Standard Time), in case anyone was wondering.

Anyone have any insight into this issue?

The error was originally experienced on Date::Manip 6.22, upgrading to 6.40 removed the WARNING message, but reproduced the same behaviour.

Now, I don't need to resolve the issue, but am interested in understanding it. I appreciate any info.

Comment on No value returned when using Date_Init
Select or Download Code
Re: No value returned when using Date_Init
by choroba (Abbot) on Jul 16, 2013 at 07:45 UTC
    There was a change in time (daylight savings) on the given date and time.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: No value returned when using Date_Init
by Loops (Curate) on Jul 16, 2013 at 08:32 UTC

    As an admittedly peripheral issue, the TZ variable is being removed from Date::Manip in a few months. You may want to update your code to use the suggested "setdate" instead. For example:

    Date_Init("setdate=now,+0930");