Help for this page

Select Code to Download


  1. or download this
    perl6 -e  'say Date.new("2019-01-20"); say Date.new("2019-01"); '
    2019-01-20
    Invalid Date string '2019-01'; use yyyy-mm-dd instead
      in block <unit> at -e line 1
    
  2. or download this
    
    use Time::Piece; localtime()->strptime(@ARGV[0], "%Y-%m");
    
  3. or download this
    
    bash$    perl -e 'use Time::Piece; localtime()->strptime(@ARGV[0], "%Y
    +-%m"); print "ok\n"; '  "2019-01"
    ...
    Error parsing time at /usr/lib/x86_64-linux-gnu/perl/5.26/Time/Piece.p
    +m line 481.