I'm trying to make a date script. It works fine, except between 12:00 AM and 1:00 AM it displays PM. Here's the poop:
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, isdst) = localti
+me(time);
@days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
@months = qw(01 02 03 04 05 06 07 08 09 10 11 12);
$sec = sprintf ("%02d", $sec);
$central_time_min = $min;
$central_time_min = sprintf ("%02d", $central_time_min);
$mday = sprintf ("%02d", $mday);
$year = "02";
$zone = "Central Time";
$central_time_hour = $hour + 1;
$ampm = "AM";
if ($central_time_hour > 11)
{
$ampm = "PM";
}
if ($central_time_hour > 12)
{
$central_time_hour = $central_time_hour - 12;
}
Could some kind soul help me please?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.