Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BusinessHours bh = [SELECT FridayEndTime,FridayStartTime,Id,MondayEndTime,MondayStartTime,
- FROM BusinessHours where Name='Test Business Hour'
- LIMIT 1];
- Time startTime = bh.MondayStartTime;
- Time endTime = bh.MondayEndTime;
- Date d = Date.today();
- Datetime monTodaystart = Datetime.newInstance(d.year(),d.month(),d.day(),startTime.hour(), startTime.minute(),startTime.second());
- Datetime monTodayend = Datetime.newInstance(d.year(),d.month(),d.day(),endTime.hour(), endTime.minute(),endTime.second());
- System.debug('monTodaystart :: '+monTodaystart);
- System.debug('monTodayend :: '+monTodayend);
- Long diff = BusinessHours.diff(bh.Id, monTodaystart, monTodayend);
- System.debug('diff :: '+diff);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement