atoomic / perl-TimeDate

time & date parsing and formatting perl library
http://search.cpan.org/dist/TimeDate/
1 stars 4 forks source link

str2time incorrectly converts old years #47

Open kostiantynkh opened 9 months ago

kostiantynkh commented 9 months ago

Hi! I pass the value "1974-01-01 00:00:00" and expect the correct result to be "126219600". But actually I get the value "3281990400" which corresponds to "2074-01-01". The same behavior for older years, for example 1973, 1972, etc.

    use Date::Format;
    use Date::Parse;
     use Data::Dumper;

     my $date = '1974-01-01 00:00:00';

     warn Dumper ($date);
    # $VAR1 = '1974-01-01 00:00:00';

    my $date_from = str2time($date);
    warn Dumper ($date_from);
    # $VAR1 = 3281990400;

    warn Dumper (time2str("%Y-%m-%d", $date_from));
    # $VAR1 = '2074-01-01';