Function to calculate diference between 2 times?

Hi All,
Does anybody knows a functions, that <b>calculates the diference in hours</b> of to times, having in acount also the date?
For example: The diference between <b>23h00 of 17.01.2007</b> and <b>04h00 of 18.01.2007</b>. Result 5 hours.
Thanks in advanced.
Marcelo Moreira

Hi,
Please check this FM.
CCU_TIMESTAMP_DIFFERENCE.
SD_DATETIME_DIFFERENCE
Regards,
Ferry Lianto

Similar Messages

  • How to calculate period between date/time?

    All,
    I have not been able to find any function module that does this.
    I have a create date/time from a table (VBAK).
    I need to calculate the difference in days/hours/minutes (seconds not needed) between the date in this table and the current date/time.
    Then based on the result - e.g. difference is say 2 days 3 hours and 50 minutes - I will compare to a comfigured period users input to determine record selection.
    I can get date difference - SAP handles that - but the hours and minutes are a different story.
    Thanks.
    Scott

    No Matters if problem solved by own. Surely Posting a solution would help others needed person in future .

  • Using analytical function to calculate concurrency between date range

    Folks,
    I'm trying to use analytical functions to come up with a query that gives me the
    concurrency of jobs executing between a date range.
    For example:
    JOB100 - started at 9AM - stopped at 11AM
    JOB200 - started at 10AM - stopped at 3PM
    JOB300 - started at 12PM - stopped at 2PM
    The query would tell me that JOB1 ran with a concurrency of 2 because JOB1 and JOB2
    were running started and finished within the same time. JOB2 ran with the concurrency
    of 3 because all jobs ran within its start and stop time. The output would look like this.
    JOB START STOP CONCURRENCY
    === ==== ==== =========
    100 9AM 11AM 2
    200 10AM 3PM 3
    300 12PM 2PM 2
    I've been looking at this post, and this one if very similar...
    Analytic functions using window date range
    Here is the sample data..
    CREATE TABLE TEST_JOB
    ( jobid NUMBER,
    created_time DATE,
    start_time DATE,
    stop_time DATE
    insert into TEST_JOB values (100, sysdate -1, to_date('05/04/08 09:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 11:00:00','MM/DD/YY hh24:mi:ss'));
    insert into TEST_JOB values (200, sysdate -1, to_date('05/04/08 10:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 13:00:00','MM/DD/YY hh24:mi:ss'));
    insert into TEST_JOB values (300, sysdate -1, to_date('05/04/08 12:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 14:00:00','MM/DD/YY hh24:mi:ss'));
    select * from test_job;
    JOBID|CREATED_TIME |START_TIME |STOP_TIME
    ----------|--------------|--------------|--------------
    100|05/04/08 09:28|05/04/08 09:00|05/04/08 11:00
    200|05/04/08 09:28|05/04/08 10:00|05/04/08 13:00
    300|05/04/08 09:28|05/04/08 12:00|05/04/08 14:00
    Any help with this query would be greatly appreciated.
    thanks.
    -peter

    after some checking the model rule wasn't working exactly as expected.
    I believe it's working right now. I'm posting a self-contained example for completeness sake.I use 2 functions to convert back and forth between epoch unix timestamps, so
    I'll post them here as well.
    Like I said I think this works okay, but any feedback is always appreciated.
    -peter
    CREATE OR REPLACE FUNCTION date_to_epoch(p_dateval IN DATE)
    RETURN NUMBER
    AS
    BEGIN
    return (p_dateval - to_date('01/01/1970','MM/DD/YYYY')) * (24 * 3600);
    END;
    CREATE OR REPLACE FUNCTION epoch_to_date (p_epochval IN NUMBER DEFAULT 0)
    RETURN DATE
    AS
    BEGIN
    return to_date('01/01/1970','MM/DD/YYYY') + (( p_epochval) / (24 * 3600));
    END;
    DROP TABLE TEST_MODEL3 purge;
    CREATE TABLE TEST_MODEL3
    ( jobid NUMBER,
    start_time NUMBER,
    end_time NUMBER);
    insert into TEST_MODEL3
    VALUES (300,date_to_epoch(to_date('05/07/2008 10:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 19:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (200,date_to_epoch(to_date('05/07/2008 09:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 12:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (400,date_to_epoch(to_date('05/07/2008 10:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 14:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (500,date_to_epoch(to_date('05/07/2008 11:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 16:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (600,date_to_epoch(to_date('05/07/2008 15:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 22:00','MM/DD/YYYY hh24:mi')));
    insert into TEST_MODEL3
    VALUES (100,date_to_epoch(to_date('05/07/2008 09:00','MM/DD/YYYY hh24:mi')),
    date_to_epoch(to_date('05/07/2008 23:00','MM/DD/YYYY hh24:mi')));
    commit;
    SELECT jobid,
    epoch_to_date(start_time)start_time,
    epoch_to_date(end_time)end_time,
    n concurrency
    FROM TEST_MODEL3
    MODEL
    DIMENSION BY (start_time,end_time)
    MEASURES (jobid,0 n)
    (n[any,any]=
    count(*)[start_time<= cv(start_time),end_time>=cv(start_time)]+
    count(*)[start_time > cv(start_time) and start_time <= cv(end_time), end_time >= cv(start_time)]
    ORDER BY start_time;
    The results look like this:
    JOBID|START_TIME|END_TIME |CONCURRENCY
    ----------|---------------|--------------|-------------------
    100|05/07/08 09:00|05/07/08 23:00| 6
    200|05/07/08 09:00|05/07/08 12:00| 5
    300|05/07/08 10:00|05/07/08 19:00| 6
    400|05/07/08 10:00|05/07/08 14:00| 5
    500|05/07/08 11:00|05/07/08 16:00| 6
    600|05/07/08 15:00|05/07/08 22:00| 4

  • Query designer - calc diference between lines

    Dear coleagues,
    i need to calculate diference between actual line and last line like this example::
    Material  Month Value        Diference with Last Month
    A0001   01        100,00
    A0001   02        150,00      50,00
    A0001   03        250,00      100,00
    How can i do this on Query Designer ??
    Thanks in advance.
    Fabrício

    HI ,
    Just a try ,
    Create a calculated KF1 with value --> with first value in exception aggregation  tab --> with reference characteristic as Month
    Create a calculated KF2 with value --> with Last value in exception aggregation  tab --> with reference characteristic as Month
    KF3 = KF2 - KF1
    Regards,
    Sathya

  • How to use case when function to calculate time ?

    Dear All,
    May i know how to use case when function to calculate the time ?
    for the example , if the First_EP_scan_time is 12.30,  then must minus 30 min.  
    CASE WHEN FIRSTSCAN.EP_SHIFT <> 'R1' AND FIRSTSCAN.EP_SHIFT <> 'R2'
    THEN ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF((CASE WHEN SHIFTCAL.EP_SHIFT = 'N1'
    THEN CONVERT(VARCHAR(8),DATEADD(DAY,+1,LEFT(FIRSTSCAN.EP_SCAN_DATE ,8)),112) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','')
    ELSE LEFT(FIRSTSCAN.EP_SCAN_DATE ,8) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','') END),12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0 - 0.25) AS FLOAT),2)
    ELSE ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF(FIRSTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0) AS FLOAT),2) END AS OTWORK_HOUR

    Do not use computations in a declarative language.  This is SQL and not COBOL.
    Use a table of time slots set to one more decimal second of precision than your data. You can now use temporal math to add it to a DATE to TIME(1) get a full DATETIME2(0). Here is the basic skeleton. 
    CREATE TABLE Timeslots
    (slot_start_time TIME(1) NOT NULL PRIMARY KEY,
     slot_end_time TIME(1) NOT NULL,
     CHECK (start_time < end_time));
    INSERT INTO Timeslots  --15 min intervals 
    VALUES ('00:00:00.0', '00:14:59.9'),
    ('00:15:00.0', '00:29:59.9'),
    ('00:30:00.0', '00:44:59.9'),
    ('00:45:00.0', '01:00:59.9'), 
    ('23:45:00.0', '23:59:59.9'); 
    Here is the basic query for rounding down to a time slot. 
    SELECT CAST (@in_timestamp AS DATE), T.start_time
      FROM Timeslots AS T
     WHERE CAST (@in_timestamp AS TIME)
           BETWEEN T.slot_start_time 
               AND T.slot_end_time;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Calculate difference between two dates/times

    Hi all,
    Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.
    I need to know how many millisconde(second,minutes, hours... )there is between these two times.
    Please, It is urgent
    Thank you all.
    Karim

    hi,
    try the following function
    CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'        
          EXPORTING                                  
               timestamp1 = timestamp1               
               timestamp2 = timestamp2               
          IMPORTING                                  
               difference = diff                     
          EXCEPTIONS                                 
               OTHERS     = 1. 
    the above function gives the difference in seconds...
    try the following  code to set the resolution to milliseconds..
    SET RUN TIME CLOCK RESOLUTION LOW
    check the thread for details:
    SET RUN TIME CLOCK RESOLUTION?
    all the best!!!
    Regards,
    Aparna

  • 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

  • How to read time stamps from a spreadsheet and calculate the difference between consecutive time stamps?

    Hi,
    I am new to Labview. This question might be a joke to some of you here, but any help would be greatly appreciated. I have a spreadsheet with time stamps and power outputs from a generator. I am supposed to calculate the difference between consecutive time stamps, which will act as a delay for the next power output update that needs to be sent. For example, lets say that I have to following data:
    Time Stamp                    Power Output
    11:00:00 AM                       3kW
    11:00:02 AM                       2.9kW
    11:00:04 AM                       3.2kW
    11:00:06 AM                       3.1kW
    The above data doesn't make any sense, but it is just for the purpose of this question.
    So, I have to read 11:00:00 AM and 3kW initially - 3kW is the initial request that is sent. Then I have to

    Repeated forum post
    Please view http://forums.ni.com/ni/board/message?board.id=170&message.id=294435
    Regards,
    Juan Galindo
    Applications Engineer
    National Instruments

  • Need Help to calculate difference between times

    Hello everyone,
    I have two fields which just stores the time in 24 hour format ex: 08:00 and 20:00 now I want to calculate difference between the two times
    Kindle help me
    Thanks for your help
    Thanks
    Ravi

    Are your fields of varchar2 datatype or...?
    Is 08:00 the start time or 20:00?
    Date arithmetic is pretty simple in Oracle if you use the right datatype.
    See:
    http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551242712657900129
    Assuming you are storing strings:
    SQL> -- generating sample data:
    SQL> with t as (
      2  select '08:00' btime, '20:00' etime from dual
      3  )
      4  --
      5  -- actual query:
      6  --
      7  select numtodsinterval(to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'), 'day') nti
      8  ,      (to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'))*24 dt
      9  from   t;
    NTI                                                                                 DT
    +000000000 12:00:00.000000000                                                       12
    1 row selected.
    SQL>

  • Function to calculate time elapsed needed

    Hi all,
    I need a function which will give me total time elapse if I provide 2 dates with timings.
    ie Date1 : "23-Feb-2005 21:00:00"
    Date2 : "21-Feb-2005 22:00:00"
    output should be somewhat like
    1 day ,23 hrs ,00 mins and 00 secs( i.e total time elapsed).
    Regards

    Hi,
    You have the solution in Metalink note
    1035465.6: How to Display Date Difference Values in Years, Months, Days
    Nicolas

  • Numbers function IF greater than using date & time

    I am trying to produce a number sheet that will allow me calculate a working rota for staff.
    The problem i am having is when i try and use a IF function to remove 1hr (for lunch) if the person works 8 hours or more.
    If that person works between 6 and 8 they require a 30 mins lunch.
    I have already setup the sheet to calculate the total shift time by subtracting the starting time from the finishing time. i.e. 18:00 - 08:00 = 10hrs
    Now i need it to subtract 1hr for lunch.
    It should read something like IF 10 >8 then -1 from 10.
    I just don't know how to not cause an error.
    ideally i would like it to be able to handle 2 IF's in the one cell. if its 6-8hrs - 30mins or if its greater than 7 -1 hr.
    I currently have all the cells set at time and date.
    Any help would be greatly appreciated.
    Richard

    this works a little but it seems to subtract 0.5 and then 1 removing to much time.
    I have attached a link which i hope will explain this better.
    https://onedrive.live.com/redir?resid=82B56CEF9A61CDE9!8770&authkey=!ALJn-lja2b2 q1iw&ithint=file%2cnumbers
    Thank you for your help

  • Calculate duration between start date and end date

    Hi everyone,
    I'm facing with problem when calculating duration between start & end with this function below . This fuction  is working well, but i want to change working time from 8:00 am to 17:30 pm instead of 17:00 , and lunch time from 12:00 to 13:30 instead
    of 13:00 as present . Problem is , i changed data type of start hour and end hour from INT to decimal . But it is still wrong .
    Pls help me . It's very urgent bcoz i need it for monthly report .
    Many thanks .
    Here is function which im using :
    ALTER Function [dbo].[GetWorkingMin](@pStartDate DateTime, @pEndDate DateTime) Returns Int
    AS
    Begin
          Declare @StartDate DateTime = @pStartDate
          Declare @EndDate DateTime = @pEndDate
        Declare @WorkMin int = 0   -- Initialize counter
        Declare @Reverse bit       -- Flag to hold if direction is reverse
        Declare @StartWorkingHour int = 8   -- Start of business hours (can be supplied as an argument if needed)
        Declare @EndWorkingHour int = 17    -- End of business hours (can be supplied as an argument if needed)
        Declare @Holidays Table (HDate DateTime)   --  Table variable to hold holidayes
          Declare @LunchHour int = 12
          Declare @StartHour int = DatePart(HH, @StartDate)
          Declare @EndHour int = DatePart(HH, @EndDate)
        -- If dates are in reverse order, switch them and set flag
        If @StartDate>@EndDate
        Begin
            Declare @TempDate DateTime=@StartDate
            Set @StartDate=@EndDate
            Set @EndDate=@TempDate
            Set @Reverse=1
        End
        Else Set @Reverse = 0
        -- Get country holidays from table based on the country code
        Insert Into @Holidays (HDate) Select HDate from HOLIDAY Where HDATE>=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)
        If DatePart(HH, @StartDate)<@StartWorkingHour
        begin
                Set @StartDate = DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @StartDate))  
                -- If Start time is less than start hour, set it to start hour
                Set @StartHour = DatePart(HH, @StartDate)
        end
        If DatePart(HH, @StartDate)>=@EndWorkingHour
        begin
                Set @StartDate = DateAdd(hour, @StartWorkingHour+24, DateDiff(DAY, 0, @StartDate))
                -- If Start time is after end hour, set it to start hour of next day
                Set @StartHour = DatePart(HH, @StartDate)
                --return DatePart(day, @StartDate)
        end
        If DatePart(HH, @EndDate)>=@EndWorkingHour
        begin
                Set @EndDate = DateAdd(hour, @EndWorkingHour, DateDiff(DAY, 0, @EndDate))
                -- If End time is after end hour, set it to end hour
                Set @EndHour = DatePart(HH, @EndDate)           
        end
        If DatePart(HH, @EndDate)<@StartWorkingHour
        begin
                Set @EndDate = DateAdd(hour, @EndWorkingHour-24, DateDiff(DAY, 0, @EndDate))
                -- If End time is before start hour, set it to end hour of previous day
                Set @EndHour = DatePart(HH, @EndDate)
        end
        If (@StartHour>=@LunchHour and @StartHour < (@LunchHour +1))
        Begin
                Set @StartDate = DateAdd(hour, @LunchHour + 1, DateDiff(DAY, 0, @StartDate))
                -- If Start time is in lunch time, set it to 12
                Set @StartHour = @LunchHour + 1   
        End
        If (@StartHour>=@LunchHour and DatePart(DW, @StartDate) = 7)
        Begin
                Set @StartDate = DateAdd(hour, @StartWorkingHour + 24, DateDiff(DAY, 0, @StartDate))
                Set @StartHour = DatePart(HH, @StartDate)
        End
        If (@EndHour>=@LunchHour and @EndHour < (@LunchHour +1))
        Begin
                Set @EndDate = DateAdd(hour, @LunchHour +1, DateDiff(DAY, 0, @EndDate))
                -- If End time is in lunch time, set it to 13
                Set @EndHour = @LunchHour + 1
          End
          If (DatePart(DW, @EndDate) = 7 and DatePart(HH, @EndDate) >= @LunchHour) Set @EndDate = DateAdd(hour, @LunchHour, DateDiff(DAY, 0, @EndDate)) -- If End day is Saturday and End time is after end hour, set it to end hour of saturday
        If @StartDate>@EndDate Return 0
        -- If Start and End is on same day
        If DateDiff(Day,@StartDate,@EndDate) <= 0
        Begin
            If (Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7)  
            -- If day is between sunday and saturday
                If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0  
                -- If day is not a holiday
                    If @EndDate<@StartDate Return 0 Else
                    Begin
                                  Set @WorkMin=DATEDIFF(MI, @StartDate, @EndDate)
                                  -- Calculate difference
                                  If (@StartHour <= @LunchHour and @EndHour >= @LunchHour + 1)
                                        Set @WorkMin = @WorkMin - 60;                                   
                            End
                Else Return 0
            Else Begin
                      if (DATEPART(dw,@StartDate)=7) set @WorkMin = @WorkMin + DATEDIFF(MI, @StartDate, @EndDate);
                      Return @WorkMin
            End
        End
        Else Begin
            Declare @Partial int=1   
            -- Set partial day flag
            While DateDiff(Day,@StartDate,@EndDate) > 0   
            -- While start and end days are different
            Begin
                If Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7    --  If this is a weekday
                Begin
                    If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0  -- If this is not a holiday
                    Begin
                        If @Partial=1  
                        -- If this is the first iteration, calculate partial time
                        Begin
                            Set @WorkMin=@WorkMin + DATEDIFF(MI, @StartDate, DateAdd(hour, @EndWorkingHour, DateDiff(DAY, 0, @StartDate)))
                            If (@StartHour <= @LunchHour) Set @WorkMin = @WorkMin - 60;
                            Set @StartDate=DateAdd(hour, @StartWorkingHour+24, DateDiff(DAY, 0, @StartDate))
                            Set @Partial=0
                        End
                        Else Begin     
                        -- If this is a full day, add full minutes
                            Set @WorkMin=@WorkMin + (@EndWorkingHour-@StartWorkingHour - 1)*60        
                            Set @StartDate = DATEADD(DD,1,@StartDate)
                        End
                    End
                    Else Set @StartDate = DATEADD(DD,1,@StartDate)  
                End
                Else Begin
                            If (DATEPART(dw,@StartDate)=7)
                            Begin                   
                                  Set @WorkMin = @WorkMin + DATEDIFF(MI, @StartDate, DateAdd(hour, @LunchHour, DateDiff(DAY,
    0, @StartDate)));
                            End
                            --Set @StartDate = DATEADD(DD,1,@StartDate)
                            Set @StartDate = DateAdd(hour, @StartWorkingHour + 24, DateDiff(DAY, 0, @StartDate))
                                  Set @StartHour = DatePart(HH, @StartDate)
                      End
            End
            If Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7  
            -- If last day is a weekday
                If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0   
                -- And it is not a holiday
                    Begin
                                  If @Partial=0 Set @WorkMin=@WorkMin + DATEDIFF(MI, @StartDate, @EndDate) Else
    Set @WorkMin=@WorkMin + DATEDIFF(MI, DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @StartDate)), @EndDate)
                                  If (@EndHour >= (@LunchHour + 1)) Set @WorkMin = @WorkMin - 60;
                            End   
                If (DATEPART(dw,@EndDate)=7)
                Begin
                      Set @WorkMin = @WorkMin + DATEDIFF(MI, DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @EndDate)),@EndDate);        
                End
        End
        If @Reverse=1 Set @WorkMin=-@WorkMin
        Return @WorkMin
    End

    The problem is you cannot specify partial hours.
    I think your best bet would be to alter the function sufficiently so it will accept times instead of hours, and where you're making comparisons to the hour, use dates/date functions instead.
    Then, just set the variable as a full time (or datetime, if you need).

  • Time between to time

    Hi, experts
    Can i get a method that give the time between two time.
    I have two times 'oEditHEmb' and 'oEditHDeb'  which are in two columns. I want to calculate the time between these two times.
    Pls help.

    hello freind try this function
    hear yu can use  dtmStart  and dtmEnd for yur 1 colum and second colum
    Function TimeDiffString(ByVal dtmStart As String, ByVal dtmEnd As String) As Decimal
            Dim intHrs1, intMins1, intSecs1 As Decimal
            Dim intHrs2, intMins2, intSecs2 As Decimal
            Dim hrs, min As Decimal
            'Dim strHrsString, strMinsString, strSecsString As String
            'Dim dtmEnd1 As Date
            'dtmEnd1 = DateTime.ParseExact(dtmEnd, "HHmm", Nothing)
            If (dtmStart.Length < 4) Then
                dtmStart = "0" & dtmStart
            End If
            If (dtmEnd.Length < 4) Then
                dtmEnd = "0" & dtmEnd
            End If
            intHrs1 = Convert.ToDecimal(dtmStart.Substring(0, 2))
            intMins1 = Convert.ToDecimal(dtmStart.Substring(2, 2))
            intHrs2 = Convert.ToDecimal(dtmEnd.Substring(0, 2))
            intMins2 = Convert.ToDecimal(dtmEnd.Substring(2, 2))
            hrs = intHrs2 - intHrs1
            min = intMins2 - intMins1
            If (hrs < 0) Then
                Return (-1)
            ElseIf (hrs = 0) And (min < 0) Then
                Return (-1)
            ElseIf (hrs = 0) And (min = 0) Then
                Return (0)
            ElseIf (hrs = 0) And (min > 0) Then
                Return (1)
            ElseIf (hrs > 0) Then
                Return (1)
            End If
        End Function

  • What is the diference between apple tv and airport express?

    I can see tv online  in my tv whitout airport express??
    What is the diference between apple tv and new apple tv2?

    Airport is a router, Apple TV is a set-top box.
    http://www.apple.com/airportexpress/
    http://www.apple.com/appletv/
    Original Apple TV had a hard-drive, and has been discontinued for quite some time.
    ATV2 is a streaming only device, smaller, and use less power. It is also now discontinued
    The current model, ATV 3, has a better chip allowing for 1080P playback.

  • 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....

Maybe you are looking for

  • Imac, mobile me and iphone not syncing

    I had a big software problem with my iMac and I was told i might need a new hard drive and so I was afraid (probably needlessly) that if i had a new hard drive and lost all my info that my contacts and calendar on my imac would be blank and that it m

  • Security Question not appearing in Log on help

    Hi, I have done all the settings from my end to enable security questions in Log on help at the time of password reset by user. But still it is not asking for a security question at the time of password reset by an existing user.  It is still asking

  • Envelopes do not print properly using an All-in-One Photosmart C410a and C310a

    My HP C410a is USB attached. Serial Using Windows 7, SP2 (Home Premium - desktop); and Windows XP (laptop) Using Word 2010 (WIN7) and Word 2007 (WIN/XP) The printer has latest drivers:  PS_AIO_07_C410_FSW_Full_Win_enu_140_222.exe April 1, 2010 It pri

  • RTMPS not working in Android Air 3.8.0.820

    If i build my app with 3.7.0.1530 then an RTMPS connection (proxyType = "best") works fine. If I build with 3.8.0.820, on Android I get a NetConnection.Connect.Failed after about 10 seconds. Works fine with 3.8 on iOS & OS X. Any ideas?

  • Integration Builder Locks Up when choosing target message

    Hi all, I have a xsd file which I have uploaded to XI as an external definition. When I try and select it as a target message in message mappings the program locks up. I get as far as as selecting my root node but as soon as I hit Apply the program l