perl how to convert a string to Datetime?

前端 未结 3 994
天涯浪人
天涯浪人 2021-02-05 10:06

I tried to convert a string to date in perl, but get error.

use strict; 
use warnings;  
use DateTime;  
use Date::Manip;

my $date = ParseDate(\"20111121\");
p         


        
3条回答
  •  日久生厌
    2021-02-05 10:38

    From the module documentation: This module does not parse dates

    You need to add code such as suggested in I printed a date with strftime, how do I parse it again? to convert from a string to a date time object.

提交回复
热议问题