Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: perl logic to calculate total time taken excluding non working hours

by ablanke (Vicar)
on Jan 29, 2018 at 10:46 UTC ( #1208037=note: print w/replies, xml ) Need Help??


in reply to perl logic to calculate total time taken excluding non working hours

Hi sachinhere,

Date::Manip offers a lot of date/time operation.

use strict; use warnings; use Date::Manip; my $task_start = new Date::Manip::Date; my $task_end = new Date::Manip::Date; my $err = $task_start->parse('Jan 30 2018 4:30 PM EST'); $err = $task_end->parse('Jan 31 2018 9:00 AM EST'); my $delta = $task_start->calc($task_end); print $delta->value()."\n"; #0:0:0:0:16:30:0 $task_start->config('WorkDayBeg','08:30:00'); $task_start->config('WorkDayEnd','17:00:00'); $task_end->config('WorkDayBeg','08:30:00'); $task_end->config('WorkDayEnd','17:00:00'); $delta = $task_start->calc($task_end,"business"); print $delta->value()."\n"; #0:0:0:0:1:0:0
  • Comment on Re: perl logic to calculate total time taken excluding non working hours
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1208037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2020-05-25 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (143 votes). Check out past polls.

    Notices?