1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| sub get_todays_date
{
# /* Get The Current Date (Open As A new Thread) */
open(DT, "date +\%D |");
# /* Store The Date In Variable $rawdate, and remove any new line characters */
chomp($rawdate = <DT>);
# /* Close The "Date" Process */
close(DT);
# /* Rip Apart The Raw Date Into Respective Parts */
($month, $day, $year) = split(/\//, $rawdate);
# /* Format The Parts Of The Date Into Our Desired Format */
$good_date = "20$year-$month-$day";
# /* Return The Formated Date Back To Our Main Program From This Sub */
return $good_date;
} |
Partager