FormCalc Formula to tell the difference between two time fields if they are populated - Help please

Hi,
I have a cell (TotalTime1) that references two other time formatted cells (Start1 and Finish 1).
The below formula is intended to tell the difference between the Start and Finish time if they are populated.
I had it working without the HasValue condition but the formula was calculating when there was no value in Start1 and Finish1 (due to time format).
This is the code I do have, it says there is an error near the last line; I am sorry if I post this in the wrong manner, I have not posted on this forum before but here goes:
if (HasValue (Finish1)  and HasValue (Start1)) then if (Time2Num(Start1.formattedValue, "HH:MM") < Time2Num (Finish1.formattedValue, "HH:MM")) then Abs (Time2Num(Start1.formattedValue, "HH:MM") - Time2Num(Finish1.formattedValue, "HH:MM")) / (60 * 60 * 1000) else 24 - Abs (Time2Num(Finish1.formattedValue, "HH:MM") - Time2Num(Start1.formattedValue, "HH:MM")) / (60 * 60 * 1000) endif 
Any help would be appreciated.
Regards Fetachini

Thanks whyisthisme,
Your speedy response is greatly appreciated, your support has resolved my issue.
Many thanks.
Regards
Fetachini

Similar Messages

  • Extract Time from date and Time and Need XLMOD Funtion to find the Difference between Two Time.

    X6 = "1/5/15 5:16 AM" & NOW ....................difference by Only Time
    not date
    X6 date and Time will be changing, Its not Constant
                Dim myDateTime As DateTime = X6
                Dim myDate As String = myDateTime.ToString("dd/MM/yy")
                Dim myTime As String = myDateTime.ToString("hh:mm tt")
                Dim myDateTime1 As DateTime = Now
                Dim myDate1 As String = myDateTime1.ToString("dd/MM/yy")
                Dim myTime1 As String = myDateTime1.ToString("hh:mm tt")
    Need to use this function to find the Difference between Two Time. due to 12:00 AM isuue
    Function XLMod(a, b)
        ' This replicates the Excel MOD function
        XLMod = a - b * Int(a / b)
    End Function
    Output Required
     dim dd  = XLMod(myTime - myTime1)
    Problem is myTime & myTime1 is String Need to convert them into Time, Later use XLMOD Funtion.

    Induhar,
    As an addendum to this, I thought I'd add this in also: If you have two valid DateTime objects you might consider using a class which I put together a few years ago
    shown on a page of my website here.
    To use it, just instantiate with two DateTime objects (order doesn't matter, it'll figure it out) and you'll then have access to the public properties. For this example, I'm just showing the .ToString method:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim date1 As DateTime = Now
    Dim date2 As DateTime = #1/1/1970 2:35:00 PM#
    Dim howOld As New Age(date1, date2)
    MessageBox.Show(howOld.ToString, "Age")
    Stop
    End Sub
    End Class
    I hope that helps, if not now then maybe at some point in the future. :)
    Still lost in code, just at a little higher level.
      Thanx frank, can use this in Future....

  • Function Module to find the Difference between two times.

    Hi All,
    Wud you plz let me know the Function Module to find the Difference between two times.
    Input Time1( Hours:Minutes) Time2 ( Hours:Minutes)
    Need Output in Hours:Minutes only . ( No seconds Needed )
    Ex :
    Input :
           06:00 to 18:00 Output : 12:00
    and  20:00 to 06:00 Output: 10:00 with +ve sign only. No -ve sign.
    Thanks,
    N.L.Narayana

    check this .
    data : p_timel like sy-uzeit,
           p_timeh like sy-uzeit,
           diff like sy-uzeit,
           di(8) type c .
           p_timel = '200000'.
           p_timeh = '060000'.
           diff = p_timeh - p_timel.
           concatenate diff+0(2) ':' diff+2(2) into di.
           write:/ di.
    also check for this.
           p_timel = '060000'.
           p_timeh = '180000'.
    see if this can be implemented in ur code .
    or else  u can try with  Fm L_TO_TIME_DIFF passing startdate enddate starttime endtime with UOM as MIN
    hope this helps regards,
    vijay

  • Function Module to get the difference between two times.

    Hi All,
    I want to know if there is any function module that gives me the difference between two specified times.
    For Ex: Time 1: 12/01/2007 00:01 A.M
                Time 2: Time 1 - 180 Seconds. This changes the time, also may even change the Date. (As in above situation, the Time 2 will be 11/30/2007 11:58 P.M)
    Could some one please suggest if there is any function module for this case.
    Thanks in Advance.

    Hi, You can use the following function module to calculate the diffrence between to dates in the unit that you want.
    COPF_DETERMINE_DURATION calculates the difference between two dates and time in minutes and hours.
    Parameters:
    EXPORTING
         I_START_DATE "The start date of the time interval
         I_START_TIME "The start time of the time interval
         I_END_DATE   "The end date of the time interval
         I_END_TIME   "The end time of the time interval
         I_UNIT_OF_DURATION "Time unit of the duration if not to be calculated in days.
         Value     =====     Meaning
         ' '     =====     Day (default)
         D     =====     Days
         H     =====     Hours
         MIN     =====     Minutes
         MON     =====     Months
         S     =====     Seconds
         WK     =====     Weeks
         YR     =====     Years
         I_FACTORY_CALENDER     "A factory calender if not using the Gregorian calender
    IMPORTING
         E_DURATION      "Time difference in unit specified.
    Message was edited by:
            Rajesh Soman

  • Help I need to subtract times to find the difference between two times?

    Hello there, I really need help.
    I'm trying to make this attendance tracking system so that when a user enters his or her ID the system wll remember his/her check in time. However I also need to find out either how late the person is or how early to store their over time and late.
    So I get the time by using a timestamp, so I'm left with a timestamp that I store into the db. But the problem comes when trying to compute for the late or over time. To do that I have to get the normal login/checkin time from the employee schedules table in the db and either subtract that time from the checkInTime to compute for how late or subtract the checkIn time from it to find early.
    The thing is, the schedule is stored in datetime format in the db since the db is sql. Also I have no idea on how to subtract the two dates via java. The month, date and year stored in the sql db are just fillers, all I need computed is the time difference of the hours and minutes between the checkInTime and the schedule.
    I've tried to use datediff: SELECT e.employeeNumber, datediff('hh', startTime, checkInTime) as lateTime from employeeschedules e, timandattendance, contractualemployees c where c.scheduleNumber=e.scheduleNumber and t.employeeNumber=c.employeeNumber and t.checkInNumber=1;
    But it keeps on giving out various errors: You have an error in your sql syntax check your manual that corresponds to your sql server version. for the right syntax to use near , checkInTime) as lateTime from employeeschedules e, timandattendance, contractualemployees c where c.scheduleNumber=e.scheduleNumber and t.employeeNumber=c.employeeNumber and t.checkInNumber=1;
    My sql server is My SQL 5.0.5
    Now I'm thinking of useing Gregorian instead, but I don't know how to use Gregorian and dont know the various methods. Can someone tell me what to do, provide some sample codes and references that I can use to accomplish what I need to do?

    NewtonsApple_2 wrote:
    Now I'm thinking of useing Gregorian instead, but I don't know how to use Gregorian and dont know the various methods. Can someone tell me what to do, provide some sample codes and references that I can use to accomplish what I need to do?it may help...
    GregorianCalendar

  • How do I calculate the difference between two times?

    I am so embarrassed by the fact that I can't figure this out.
    Cell B2- 8:00 am
    Cell C2- 10:50 am
    Cell D2- (How do I get this cell to calculate the difference and say 2:50?)
    I know this is probably one of the most basic operations, but for the life of me I can't figure it out. Cells B2 & C2 are formatted for 24 hour clock. But if I tell the system to just subtract the two, I get "0.118". Everything I find on the forum search goes beyond what I need. Can anyone help me?
    Thank you.

    KOENIG Yvan wrote:
    Numbers states clearly in the Help and the PDF Users Guide that it doesn't know a "duration" object but a time one which is restricted to the range 00:00:0 to 23:59:59.
    When I search the U.S. language Numbers User Guide for the word "duration," it is not found.
    What may be more clear: _duration is not available but time is_?
    Once again your response resemble to a rant againt the Help and the User Guide.
    In the Help:
    +date-time Any Numbers date/time value. _While you can choose to display only date or time in a cell, all Numbers date or time values contain both the date and time._+
    Which wording would be more clear and precise?
    TIMEVALUE
    +The TIMEVALUE function converts a date, a time, or a text string to _a decimal fraction of a 24-hour day._+
    Which wording would be more clear and precise?
    TIME
    +The TIME function converts hours, minutes, and seconds into a time format.+
    +TIME(hours, minutes, seconds)+
    +hours: The number of hours _(using a 24-hour clock)._+
    +minutes: The number of minutes.+
    +seconds: The number of seconds.+
    Notes
    +You can specify hour, minute, and second values greater than 23, 59, and 59, respectively. _If the hours, minutes, and seconds add up to more than 24 hours, Numbers subtracts 24 hours repeatedly until the sum is less than 24 hours._+
    Which wording would be more clear and precise?
    In the User Guide:
    page 190
    +date-time Any Numbers date/time value. _While you can choose to display_+
    +_only date or time in a cell, all Numbers date or time values contain_+
    +_both the date and time._+
    +TIME (page 277) Converts a time to a decimal fraction of a 24-hour day.+
    +TIMEVALUE (page 278) Converts a time in a string to a decimal fraction of a 24-hour day.+
    TIME
    +The TIME function converts the specified time to a decimal fraction of a 24-hour day.+
    +TIME(hours, minutes, seconds)+
    +• hours: The number of hours _(using a 24-hour clock)_.+
    +• minutes: The number of minutes.+
    +• seconds: The number of seconds.+
    Notes
    +You can specify hour, minute, and second values greater than 23, 59, and 59,+
    +respectively. _If the hours, minutes, and seconds add up to more than 24 hours,_+
    +_Numbers subtracts 24 hours repeatedly until the sum is less than 24 hours._+
    +You can also specify fractional values for hours, minutes, or seconds.+
    TIMEVALUE
    +The TIMEVALUE function converts a time in a string to a decimal fraction of a 24-hour+
    day.
    TIMEVALUE(date-time)
    +• date-time: A date, a time, or a string in any of the Numbers date and time formats.+
    As you may check, the infos are exactly the same in the Help and in the Guide.
    And I really don't understand how you may find them unclear.
    Yvan KOENIG (from FRANCE lundi 4 août 2008 14:57:36)

  • How to do find the difference between two time stamps

    Hi all,
    i have a table with 2 columns called GMT time and Local time . so i need to find difference between these two time stamps.
    i tried like this
    select to_date(GMT_TIME,'yyyy-mm-dd hh24:hi:ss')-to_date(LOCAL_TIME,'yyyy-mm-dd hh24:hi:ss') from date_table
    the result is coming as follows ..
    0.291666666667
    i did not under stand the out put.
    In my table GMT_TIME= 2011-06-26 00:00:00 and LOCAL_TIME=2011-06-25 17:00:00 ..
    please help me how to get exact hours between two dates ..
    Thanks
    Sreedhar

    Hi Sreedhar,
    Your output (0.2916666) has the unit day.
    You should multiply with 24 to get the unit hour.
    select ( to_date(GMT_TIME,'yyyy-mm-dd hh24:hi:ss')-to_date(LOCAL_TIME,'yyyy-mm-dd hh24:hi:ss') ) * 24 from date_table;Rgds,
    Tycho

  • ITunes cannot tell the difference between two shuffles.

    I have two shuffles (first gen.) and itunes is not distinguishing between them. When I put in my second (newer) shuffle, it comes up with an error message saying:
    1. that it thinks it is my first shuffle
    2. that it is synced to another library and needs to be erased and synced.
    How do I get itunes to realize that I have two different shuffles???
    Thanks!

    Thanks whyisthisme,
    Your speedy response is greatly appreciated, your support has resolved my issue.
    Many thanks.
    Regards
    Fetachini

  • How to find differene between two time fields??

    Hi Experts,
    I am trying to find difference between two time fields,  I have created two formula variables by using replacement path for the two time fields, I have taken dimension key NUMBER, because of this time format is converting to numbers for example if the time is 13:20:10 then it is converting to 1,32,010 then it is calculating, I am getting wrong values.
    Is there any options to find out the difference between two time fields.
    Thanks in advance,
    Venkat.

    use COPF_DETERMINE_DURATION. Its better you do it in data model itself.
    If you have date and time seperately use command
    use CONVERT TIMESTAMP command and
    then use this function module to get the difference in
    timestamp
    CCU_TIMESTAMP_DIFFERENCE
    us this in conjunction with the below function module
    DAYS_BETWEEN_TWO_DATES
    Edited by: Ananda Theerthan on Jan 21, 2010 7:18 AM

  • HT4060 How can i tell the difference between chargers

    How can i tell the differance between chargers

    Believe it or not, they are identified right on the chargers themselves.  Unfortunately, the font is real small and the print is gray on a white background.  It's nearly impossible to read.  You need a bright light and a magnifying glass!
    After determining which is which, you might wish to put your own paper labels on them.

  • How do you tell the difference between a genuine USB to Lightning cable? I spoke to two different operators at Apple Support. One said that it has Designed in California Made in China and the serial number on it, and the other operator said it didn't

    How can you tell the difference between a genuine Apple lead and the cheap, or sometimes not so cheap imitations? I spoke with two people at Apple Support - one said that it has Designed in California Made in China and the serial number stamped on it, and the other said it didn't. Come on guys, how are we supposed to tell if you can't? I'd really like to know how to identify my lead amongst my daughter's gazillion fakes?

    All my cables are genuine either with the devices or from Apple retail Store I have never found a serial number on any regardless of which length ,I have all three lengths
    In fact they have nothing printed at all only a USB logo at relevant end

  • To calculate the difference between two periods  in SSM

    Hi,
    I have two questions need to be clarified.
    Question 1: I have KPI named Revenue growth and the formula to calculate is  (current year revenue - previous year revenue).I am using data entry& approval.Is that technically possible to calculate the revenue difference between two periods in SSM?
    Question 2: Is that possible to enter the date as input for the variable?for example i want find the difference between two dates and the difference value is output for my variable.
    Regards
    Bala

    Hi:
    Question 1:
    We have same problem, and what we did is to create:
    - 2 NON KPI:
    R1 = Revenue current year
    R2 = Revenue previous year
    - 1 virtual KPI
    R3 = R2-R1
    Question 2:
    I don't know.
    Regards.

  • Can anyone tell the difference between USB 3.0 and 2.0?

    I have both a 8GB flashdrive 3.0 and 2.0. I got the 3.0 at office depot for $8.00 and 2.0 for the same price at best buy. I honestly can't tell the difference between the two. They both seem to be the same in speed. Is there really a difference?

    This is an interesting subject, I just recalled a MacWorld podcast I was listening to when the 3.0s were first hitting the market. A guest on the podcast was saying to think of it like a 'bottle neck' not so much as speed. With the 3.0 you can push more information through at any one time. So in the case of the hd movie senario, if you had multiple movies transfering at one time the 3.0 would be a lot faster than a 2.0.

  • How to get the difference between two date

    Hello,
    I want to know how to write a code the tell me the difference between two date, I am using
    oracle.jbo.domain.Date
    i have a rent date and return date so my code is
    Date rent=(Date)nr.getAttrbute("RentDate"),ret=(Date)nr.getAttrbute("ReturnDate");
    is there a way to know the difference in days between those two dates ?
    Thanks

    hi,
    try this.....
    DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
    Date date = (Date)formatter.parse(dateStr); //// dateStr <- from date value (that is string value)
    Date dateto = (Date)formatter.parse(datetostr); //// datetostr <- to date value (to date getting from as a string)
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    Calendar calto = Calendar.getInstance();
    calto.setTime(dateto);
    fromDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
    toDate = calto.get(Calendar.DATE) + "/" + (calto.get(Calendar.MONTH) + 1) + "/" + calto.get(Calendar.YEAR);
    // System.out.println("from Date : " + fromDate);
    if ((fromDate != null && toDate != null) && (date.compareTo(dateto) > -1) ) {                  
    fc.addMessage("VacationQueryComponent", new FacesMessage(FacesMessage.SEVERITY_ERROR, "From Date cannot be lower than To Date", "From Date cannot be lower than To Date"));
    fc.renderResponse();
    thks.

  • Calculate the difference between two dates times in infopath form 2013

    Hi,
    I have an infopath 2013 form that contains three fields:
    2 date time and the 3rd contains the difference between the two in hours
    how I can make the difference between the two so that the display will be like this:
    Date Time1           08/21/2014           22:00 
    Date Time2           08/22/2014           1:00
    Diff Field                                             3:00

    Hi,
    Please refer to the following article which matches your requirement exactly.
    Calculate the difference between two date picker controls in InfoPath using rules and formulas - no code!
    Please mark it answered, if your problem resolved.

Maybe you are looking for

  • Creating a home and mobile iTunes library

    I'm trying to figure out how to manage the chaos of my home media.  I currently have the following equipment: Desktop Laptop WD Network HD WD Portable USB HD iPhone 4 iPod Nano I would like to make it so that my Network HD is the primary location of

  • How do i move songs from apple id to my new ipod without a computer

    I do not use a computer to purchase songs but rather purchase them straight from my iphone.  I now would like to also use those songs on my ipod nano but I do not have a computer to sync the ipod with.  How does a person put songs on their ipod witho

  • Finder Crashes, Restarts, Crashes, etc.

    I was coping a PowerPoint file from a co-workers memory stick and Finder crashed. When I restarted, the Apple Menu Bar flashes continuously and my hard drive will not appear. I am able to login into my admin account and the systems works fine. The re

  • Upgrade from xp 32-bit to win 7 pro 64-bit

    How can i get my bootcamp partition to upgrade to windows 7. What i have to do is restart windows and start the win 7 installer when win xp isnt booted.

  • Designer/2000 v2.1 with Rdbms 8.0.5 ,OAS 4.0 on NT

    Hi, I installed Oracle server v8.0.5( enterprise edition) and Application server 4.0 on Win NT. It works fine. But when I try to install designer/200 v 2.1 or developer/2000 v2.1( server edition) on top , the installation stops in the middle by givin