use strict; use warnings; use POSIX qw{ strftime }; my $db_time = "7:05"; my $current_hour = strftime( "%H", localtime() ); my $current_minute = strftime( "%M", localtime() ); my ($db_hour, $db_minute) = split( /:/, $db_time ); if ( $db_hour > $current_hour ) { print "It is still open.\n"; } elsif ( $db_hour < $current_hour ) { print "It is closed already.\n"; } elsif ( $db_minute > $current_minute ) { print "It is still open\n"; } elsif ( $db_minute < $current_minute ) { print "It is closed already.\n"; } else { print "Hurry... It is closing RIGHT NOW!!!"; }
-- -- GhodmodeBlessed is he who has found his work; let him ask no other blessedness.
In reply to Re: Comparing a string value's time with the computers time
by GhodMode
in thread Comparing a string value's time with the computers time
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |