Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$yyyy = (localtime)[5] + 1900; $mm = (((localtime)[4]) + 1); $dd = (localtime)[3]; $hh = (localtime)[2]; $min = (localtime)[1]; $ss = (localtime)[0]; if ($mm < 10) { $mm = "0" . $mm; } if ($dd < 10) { $dd = "0" . $dd; } if ($hh < 10) { $hh = "0" . $hh; } if ($min < 10) { $min = "0" . $min; } if ($ss < 10) { $ss = "0" . $ss; }
$yyyy = (localtime)[5] + 1900; $mm = (((localtime)[4]) + 1); $dd = (localtime)[3]; $hh = (localtime)[2]; $min = (localtime)[1]; $ss = (localtime)[0]; $mm = "0" . $mm unless ($mm > 10); $dd = "0" . $dd unless ($dd > 10); $hh = "0" . $hh unless ($hh > 10); $min = "0" . $min unless ($min > 10); $ss = "0" . $ss unless ($ss > 10);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: best way to write code
by tlm (Prior) on Apr 12, 2005 at 12:22 UTC | |
|
Re: best way to write code
by gellyfish (Monsignor) on Apr 12, 2005 at 11:40 UTC | |
by Anonymous Monk on Apr 13, 2005 at 04:23 UTC | |
|
Re: best way to write code
by bradcathey (Prior) on Apr 12, 2005 at 12:36 UTC | |
|
Re: best way to write code
by cowboy (Friar) on Apr 12, 2005 at 14:38 UTC | |
|
Re: best way to write code
by NateTut (Deacon) on Apr 12, 2005 at 15:30 UTC | |
|
Re: best way to write code
by brian_d_foy (Abbot) on Apr 12, 2005 at 16:15 UTC | |
|
Re: best way to write code
by gam3 (Curate) on Apr 12, 2005 at 16:35 UTC | |
by strictvars (Sexton) on Apr 12, 2005 at 20:30 UTC | |
|
Re: best way to write code
by NetWallah (Canon) on Apr 12, 2005 at 20:35 UTC |