sub TimeStamp {
my($format) = $_[0];
my($return);
(my $sec,my $min,my $hour,my $mday,my $mon,my $year,my $wday
+, my $yday, my $isdst) = localtime();
$year = $year + 1900;
$mon = $mon + 1;
if (length($mon) == 1) {$mon = "0$mon";}
if (length($mday) == 1) {$mday = "0$mday";}
if (length($hour) == 1) {$hour = "0$hour";}
if (length($min) == 1) {$min = "0$min";}
if (length($sec) == 1) {$sec = "0$sec";}
if ($format == 1) {$return = "$year\-$mon\-$mday $hour\:$min
+\:$sec";}
if ($format == 2) {$return = $mon . $mday . $year;}
if ($format == 3) {$return = substr($year,2,2) . $mon . $mda
+y;}
if ($format == 4) {$return = $mon . $mday . substr($year,2,2
+);}
if ($format == 5) {$return = $year . $mon . $mday . $hour .
+$min . $sec;}
if ($format == 6) {$return = $year . $mon . $mday;}
if ($format == 7) {$return = $mday .'/'. $mon .'/'. $year .'
+ '. $hour .':'. $min .':'. $sec;}
if ($format == 8) {$return = $year . $mon . $mday . $hour .
+$min;}
if ($format == 9) {$return = $mday . '/' . $mon . '/' . $yea
+r;}
return $return;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|