How can I change the date formats in Perl?

前端 未结 5 1804
生来不讨喜
生来不讨喜 2020-12-07 02:16

I just want to convert the dates from 20111230 format to 30-dec-2011.

5条回答
  •  心在旅途
    2020-12-07 02:32

    Here is another solution. It uses DateTimeX::Easy:

    #!/usr/bin/env perl
    
    use strict;
    use warnings;
    
    use DateTimeX::Easy;
    
    my $dt = DateTimeX::Easy->parse('20111230');
    print lc $dt->strftime('%d-%b-%G');
    

提交回复
热议问题