Its kinda big, but its works..
#!/usr/bin/perl use CGI; my %months = ( 0 => 'January', 1 => 'February', 10 => 'November', 11 => 'December', 2 => 'March', 3 => 'April', 4 => 'May', 5 => 'June', 6 => 'July', 7 => 'August', 8 => 'September', 9 => 'October', ); my $date = CGI::Util::expire_calc('',''); # get time my $time_offset = 0; # offset time in hours (-12 to 12) my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($date + 3600 * $time_offset); my ($formatted_date, $cmon, $cday, $syear); $year += 1900; $cmon = $mon + 1; if ($hour < 10) { $hour = 0 . $hour; } if ($min < 10) { $min = 0 . $min; } if ($sec < 10) { $sec = 0 . $sec; } $cday = ($mday < 10)? 0 . $mday : $mday; my $ampm = 'am'; if ($hour > 11) { $ampm = 'pm'; } if ($hour > 12) { $hour = $hour - 12; } if ($hour == 0) { $hour = 12; } if ($mday > 10 && $mday < 20) { $cday = '<sup>th</sup> +'; } elsif ($mday % 10 == 1) { $cday = '<sup>st</sup>'; } elsif ($mday % 10 == 2) { $cday = '<sup>nd</sup>'; } elsif ($mday % 10 == 3) { $cday = '<sup>rd</sup>'; } else { $cday = '<sup>th</sup>'; } $formatted_date = "$hour:$min$ampm, $mday$cday, $month +s{$mon}, $year "; print "Content-type: text/html\n\n"; print "<html><h1>$formatted_date</h1></html>\n";

In reply to Re^3: I am a beginner in perl,not able to get the output for the following by SFLEX
in thread I am a beginner in perl,not able to get the output for the following by madhann

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.