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 (Monsignor)
on Jan 29, 2018 at 10:46 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1208037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found