################################################################### # sub GetDate # # # # copyright 1998 Kenneth Ruyter for The Graphic Age. # # http://www.graphicage.com mailto:keny@graphicage.com # # # # Email me if you have modifications to this script or # # suggestions to make it better. Oh, Yeah and the bug thing too.. # # # # General Description: # # sub GetDate Put the date into Readable form # # # # Key Features: # # - gives a seperate value for date and time # # - date is referred to as $date # # - time is referred to as $time # # # # Possible Future implements # # - I think the 1:00 bug is still there I'll check later # # # ################################################################### sub GetDate { # get date... # Initalize the variables $Week_Day = '1'; $Month = '1'; $Month_Day = '1'; $Year = '1'; # Set the Day and Months to a string @Week_Days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); @Months = ('January','February','March','April','May','June','July','August','September','October','November','December'); # call on localtime array and assign them to readable variables ($Minute,$Hour,$Month_Day,$Month,$Year,$Week_Day) = (localtime)[1,2,3,4,5,6]; # Make Sense of all this... # Date Conditionals if ($Month_Day < 10) { $Month_Day = "0$Month_Day";} $Year += 1900; # Make the date a string $date = "$Week_Days[$Week_Day]" . ", " . "$Months[$Month] " . "$Month_Day" . " " . "$Year"; # get time... initalize a variable $ampm = "am"; # Figure out if it's am or pm if ($Hour >= 13) {$Hour -= 11; $ampm = "pm";} if ($Hour == 0) {$Hour = 12; $ampm = "am";} if ($Minute < 10) {$time = "$Hour" . "\:" . "0" . "$Minute" . " $ampm";} if ($Minute >= 10) {$time = "$Hour" . "\:" . "$Minute" . " $ampm";} } 1;