Over a million developers have joined DZone.

Simple Output Of Date In Perl

·
// Simple output of current date in perl


  my @day_name = ("Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat.");
  my ($sec,$min,$hour,$mday,$mon,$year,$wday); 
  ($sec,$min,$hour,$mday,$mon,$year,$wday,undef,undef)=localtime(time()); $year+=1900;$mon++;
  $report_date=sprintf("%s %04d.%02d.%02d %02d:%02d",$day_name[$wday],$year,$mon,$mday,$hour,$min);
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}