Today's Date in Perl in MM/DD/YYYY format

后端 未结 7 1167
醉酒成梦
醉酒成梦 2020-12-24 11:18

I\'m working on a Perl program at work and stuck on (what I think is) a trivial problem. I simply need to build a string in the format \'06/13/2012\' (always 10 characters,

相关标签:
7条回答
  • 2020-12-24 11:47

    Perl Code for Unix systems:

    # Capture date from shell
    my $current_date = `date +"%m/%d/%Y"`;
    
    # Remove newline character
    $current_date = substr($current_date,0,-1);
    
    print $current_date, "\n";
    
    0 讨论(0)
提交回复
热议问题