I need some help from anybody who can. Here is what I have. I have a sub that grabs the time remaining for an item in a database, and displays the time remaining as 6 Days 19 Hrs.+. What I need is the time remaining to display as when it closes instead (Month/Date) like 01/29 for January 29th. Can anybody render some help on this stumping problem. Believe me I have tried to do this, but it is beyond my skills. Here is the sub:
Code:
sub time_remain($){
my $diff = $_[0] - (time + ($config{'timediff'} * 3600));
if($diff < 0){ return "Item closed" }
my $days = int ( $diff / 86400);
my $hours = int (($diff - $days * 86400) / 3600 );
my $mins = int (($diff - $days * 86400 - $hours * 3600) / 60 );
if($days > 1){
return "$days Days $hours Hrs.+";
}elsif($days == 1){
return "1 Day $hours Hrs.+";
}elsif($hours > 12){
return "$hours Hrs. $mins Min+";
}elsif($hours > 0){
return "$hours Hrs. $mins Min+";
}else{
my $secs = int ($diff-($days*86400)-($hours*3600)-($mins*60));
return "$mins Min $secs Sec+";
}
}