How can I parse a strftime formatted string in Perl?

后端 未结 3 1594
无人共我
无人共我 2021-01-19 10:19

I am new to Perl and I wan to know whether there is an inverse function to the strftime(). Look,

use POSIX qw(strftime);
print strftime(\"%YT%mT%d TTTT%H:%M:         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-19 10:58

    So easyy

    use Time::ParseDate;
    my $t = '2009T08T14 TTTT00:37:02';
    
    $t =~ s/TTTT//;
    $t =~ s/T/-/g;
    
    $seconds_since_jan1_1970 = parsedate($t)
    

提交回复
热议问题