Results 1 to 2 of 2

Thread: time difference

  1. #1
    Join Date
    Sep 2007
    Posts
    18

    Unanswered: time difference

    I have two fields start_time and end_time that are strings. I have converted them to time fields using timevalue(start_time) timevalue(end_time) but I can't seem to figure out how to get the difference between the two time fields.
    Here is what I got to work but it seems lengthy and I thought there might be an easier, softer way to get it done.

    stringvar datestring := totext({billing_tx_history_2004.date_of_service});
    stringvar econcat := (datestring & " " &{billing_tx_history_2004.end_time});
    stringvar sconcat := (datestring & " " &{billing_tx_history_2004.start_time});
    datetimevar sdtvar := datetimevalue(sconcat);
    datetimevar edtvar := datetimevalue(econcat);
    global numbervar date_df := datediff ("n",sdtvar,edtvar)

    I am using Crystal 10 and don't seem to have a TIMEDIFF functions.

    Many thanks in advance;
    a newbie
    Last edited by jerry.bates; 04-26-10 at 17:16.

  2. #2
    Join Date
    May 2010
    Posts
    6
    You need to convert your start and end time to second unit.
    Then you do the subtraction and lastly convert back to the format you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •