Help for this page

Select Code to Download


  1. or download this
    my @tm=localtime(time);
    $tm[5] += 1900;
    $tm[4] ++;
    my $timestamp = sprintf "%04d%02d%02d%02d%02d%02d", reverse @tm[0..5];
    print $timestamp, "\n"; # prints something like 20140425192252
    
  2. or download this
    my $timestamp = sprintf "%04d" . "%02d" x 5, @tm[ reverse 0..5];