Time Calculation on Custom Crew Report

Comments

3 comments

  • Benjamin 'Bigs' Coppel

    Hi Chris-

    Is there a pattern on your result text element? If so, if it's something like #,##0 that could be causing the rounding. Replace with #,##0.00 to specify how many decimal places you want to see. Or maybe the result is an integer rather than a Double or a Long? 

    If you're stuck you can email me at bigs@squarewave.com.au. I'm an endorsed independent consultant and report developer.

    Cheers

    Bigs

    0
    Comment actions Permalink
  • Chris B

    Hey Bigs,

    Thanks for the quick reply.  I tried changing the pattern, which gives me the decimal places, however those are showing up as 0. 

    I am not sure if the result is an integer.  I tried using

    LONG_VALUE(($F{alt_end_date}. getTime()-$F{alt_start_date}.getTime())/(1000*60*60) + " hours" )

    but it breaks the report.  Same with Double

    0
    Comment actions Permalink
  • Chris B

    A bunch of trial and error and a bunch of googling later and I figured it out.

    (double) ($F{alt_end_date}. getTime()-$F{alt_start_date}.getTime())/(1000*60*60)

    Thanks for pointing me in a good direction Bigs.

    1
    Comment actions Permalink

Please sign in to leave a comment.