Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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; }

In reply to Re: How can I format the output of localtime? by Mago
in thread How can I format the output of localtime? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-28 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found