use DateTime::Format::Strptime qw(); DateTime::Format::Strptime ->new(pattern => '%T.%N') ->parse_datetime('15:59:57.203') ->add(nanoseconds => 0.5 * 1000 * 1000 * 1000) ->truncate(to => 'second') ->strftime('%T'); # returns '15:59:57' DateTime::Format::Strptime ->new(pattern => '%T.%N') ->parse_datetime('15:59:57.703') ->add(nanoseconds => 0.5 * 1000 * 1000 * 1000) ->truncate(to => 'second') ->strftime('%T'); # returns 15:59:58
In reply to Re: Round off Time to nearest second
by Anonymous Monk
in thread Round off Time to nearest second
by capriguy84
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |