Skip to content

Instantly share code, notes, and snippets.

@numberwhun
Created November 28, 2011 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numberwhun/1399621 to your computer and use it in GitHub Desktop.
Save numberwhun/1399621 to your computer and use it in GitHub Desktop.
Time Stamp Code - Perl
# Some code for creating timestamps
@months = qw(01 02 03 04 05 06 07 08 09 10 11 12);
@weekDays = qw(01 02 03 04 05 06 07);
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
$year = 1900 + $yearOffset;
$theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
if ( $dayOfMonth > 9 )
{
$dt = $months[$month] . "/" . $dayOfMonth . "/" . $year;
$rundate = $year . $months[$month] . $dayOfMonth;
}
else
{
$dt = $months[$month] . "/" . '0'.$dayOfMonth . "/" . $year;
$rundate = $year . $months[$month] . '0'.$dayOfMonth;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment