> -----Original Message----- > From: David Gilden [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 5:28 PM > To: [EMAIL PROTECTED] > Subject: Date Functions > > > Hi, > > I am updating an old Script. > > Are there any problems or 'Y2k' bugs, > in the following change?
No. Looks like the old code handled the year correctly as well. The output format is slightly different, but I guess you want that. > > Thanks, > > Dave > > > #!/usr/bin/perl > > use CGI qw/:standard/; > use CGI::Carp qw(fatalsToBrowser); > use POSIX 'strftime'; > > > > # NEW -- replaces the block below > > $date = strftime('%A, %B %1d, %Y %I:%M %p',localtime) ,"\n"; > > > ################################# > # OLD -- to be removed > > > # Define arrays for the day of the week and month of the > year. > # @days = ('Sunday','Monday','Tuesday','Wednesday', > 'Thursday','Friday','Saturday'); > # @months = > ('January','February','March','April','May','June','July', > 'August','September','October','November','December'); > > # Get the current time and format the hour, minutes and > seconds. Add > # 1900 to the year to get the full 4 digit year. > > # ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > # $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); > # $year += 1900; > > # Format the date. > > # $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > > ############################ > > *====================================================* > * Cora Connection Your West African Music Source * > * http://www.coraconnection.com/ * > * Resources, Recordings, Instruments & More! * > *====================================================* > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]