use Time::Piece; my $t = Time::Piece->new(); # Roll back 12 hours (to previous day) if < 10am $t -= 12*60*60 if $t->hour() < 10; print $t->ymd("/"),"\n";