Advertisement
Kenji776

apex hour calc

Aug 22nd, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1.     Public static hourCount TimeCalcHr(DateTime InputStart, Datetime InputEnd)
  2.     {
  3.         hourCount hours = new hourCount();
  4.        
  5.         Long secondsBetween = InputEnd.getTime() - InputStart.getTime();
  6.         double totalHours = math.ceil(Integer.valueOf(secondsBetween / 60000 / 60));
  7.        
  8.         for(integer counter =0; counter <=  totalHours; counter++)
  9.         {
  10.             //some logic here to figure out of this hour is day or night
  11.             boolean isDay = true;
  12.             if(isDay)
  13.             {
  14.                 hours.dayHours++;
  15.             }
  16.             else
  17.             {
  18.                 hours.nightHours++;
  19.             }            
  20.         }
  21.    
  22.         return hours;
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement