How to find the difference between 2 time values in Java

hi all,
i have 2 time values
String time1="6:20";
String time2="21:30"
How to find the difference between 2 times in Java?
pls help
thanx in advance....

Calculating Java dates: Take the time to learn how to create and use dates
Working in Java time: Learn the basics of calculating elapsed time in Java
Formatting a Date Using a Custom Format
Parsing a Date Using a Custom Format

Similar Messages

  • How to find the difference between Project costs & Cost center costs?

    Hi all,
    Can you please explain me ? What is project Cost & Cost center cost and which are the tables having those fields of project cost & cost center Costs? And how to find the difference between their costs ? And please give me the functional Idea about it?
    Thanking you all in Advance...
    Regards,
    Chandru

    Hi,
    goto table COSP:
    1) object-no. beginning with 'KS' refer to cost-centre
       example: 'KSKOKA4711'
       with KS, KOKA = controlling area and 4711 = cost centre
    2) OBJNR beginning with 'PR' refer to projects / WBS-element
       example PR00001234
    Message was edited by: Andreas Mann

  • BCT - how to find the difference between installed BCT and the newest BCT?

    Hi,
    How do I find the difference between installed BCT and the newest BCT?
    or find a description of the newest BCT?
    Thank you.
    - Gunnar

    Hi,
    Thank you for your answer.
    I am aware of the possibilities you mention.
    I am looking for a way to find the parts of the business content that has been modified since I installed our current version WITHOUT installing anything.
    That is for example:
    If F&R business content has been moved from 3.x technology to 7.0
    If there is changes to the F&R content at all
    -> if our current version of business content already contains the newest version of Business Content for F&R, then it is not a prerequirement to an F&R project that we update business content.
    The possibility to see that the only changes might be in the area of SAP HCM ...
    Thank you.
    - Gunnar

  • How to find the differences between 4.6C and 4.7EE

    Hi,
      The client I am working for planning to upgrade from 4.6C to 4.7. As a ABAP consultant I want to know what are the changes that are made in 4.7 in ABAP. Where can I get the information i.e changes in ABAP from 4.6C to 4.7. Please advise.Please help as this is urgent for me.
    Thanks & Regards,
    Sam.

    Hi,
    to know the differences in each release
    Here is the link for the same
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5b/8c3842bb58f83ae10000000a1550b0/frameset.htm
    http://service.sap.com/releasenotes
    Check this link ... this link will definitely explin u clearly the difference between the two versions...
    http://www.stonewayinc.com/clients/sap/bestoftour/presentations/SAP_BOT_2_Furlan_IBM.ppt
    See this weblog:
    /people/thomas.jung3/blog/2005/05/15/abap-46c-to-640-delta-training
    Re: R/3 Enterprise v mySAP ERP 2003 v ECC 5.0 v mySAP ERP 2004
    http://service.sap.com/~form/sapnet?_SHORTKEY=01100035870000497320&_SCENARIO=01100035870000000112&_OBJECT=011000358700000810532004E
    Regards,
    Anver

  • How to find the difference between two date?

    Hi,
    I currently writing a date comparision program. Below is the idea analogy,
    Currently i need to find how many day differences between 30 July 2003 and 22 June 2004. How can i use java to code it?
    Thanks.

    there doesn't seem to be a direct way but try this:int daysBetween = 0;
    Calendar c = new GregorianCalendar(2004, Calendar.JULY, 30);
    Calendar d = new GregorianCalendar(2003, Calendar.JUNE, 22);
    while (c.get(Calendar.YEAR) != d.get(Calendar.YEAR)) {
        daysBetween += 360;
        d.add(Calendar.DAY_OF_YEAR, 360);
    daysBetween += c.get(Calendar.DAY_OF_YEAR) - d.get(Calendar.DAY_OF_YEAR);This gives the correct result of 404 (= 8 days from June 22 to June 30 + 366 days between July 1 of 2003 and 2004 + 30 days from July 1 to July 30)

  • How can find the difference  between iphone 5 Real Genuine adapter and fake adapter

    Can anyone please tell me, How Can Find Difference between iphone 5 Real Genuine adapter and fake adapter....

    That's about the only way. Many of the fakes are indistinguishable from genuine without taking them apart. See: https://www.youtube.com/watch?v=wi-b9k-0KfE Note that BOTH of the adapters in this video are fake. Yet the one on the left looks identical to the "real thing".

  • How to find the difference between 2 rows in a table

    Hi all
    I have a table say emp which has only 2 rows
    emp
    empno name age sex deptno
    1 X 20 M 10
    2 Y 21 M 20
    The output should be
    empno name age deptno
    1 X 20 10
    2 Y 21 20
    Since the sex are same , so it is not included in the output.
    thanks
    Hari

    Hi there rajkumar,
    Although your lead solution is more elegant than the one presented below,
    I believe the complete answer it would be:
    with mytable as (
    SELECT ROW_NUMBER() OVER (ORDER BY EMPNO) POS, Z.* FROM (
    select 1 empno, 'X' name, 20 age, 'M' sex, 10 deptno from dual
    union
    select 2, 'Y', 21, 'M', 20 from dual) Z
    SELECT
    DECODE(A.EMPNO,B.EMPNO,NULL,A.EMPNO) EMPNO,
    DECODE(A.NAME,B.NAME,NULL,A.NAME) NAME,
    DECODE(A.AGE,B.AGE,NULL,A.AGE) AGE,
    DECODE(A.SEX,B.SEX,NULL,A.SEX) SEX,
    DECODE(A.DEPTNO,B.DEPTNO,NULL,A.DEPTNO) DEPTNO
    FROM
    (SELECT * FROM mytable WHERE POS = 1) A,
    (SELECT * FROM mytable WHERE POS = 2) B
    UNION
    SELECT
    DECODE(B.EMPNO,A.EMPNO,NULL,B.EMPNO) EMPNO,
    DECODE(B.NAME,A.NAME,NULL,B.NAME) NAME,
    DECODE(B.AGE,A.AGE,NULL,B.AGE) AGE,
    DECODE(B.SEX,A.SEX,NULL,B.SEX) SEX,
    DECODE(B.DEPTNO,A.DEPTNO,NULL,B.DEPTNO) DEPTNO
    FROM
    (SELECT * FROM mytable WHERE POS = 1) A,
    (SELECT * FROM mytable WHERE POS = 2) B
    Your query indeed returns NULL in the column for which values are the same, but still, you get just the first row.
    Anyway, the question is how to dinamically select the columns that hold NULL values, in the newly generated result. Because i believe the request is like this, if column holds equal values on both rows, then don't select the column (maybe i'm wrong).
    If this is the case then just by one sql it will not solve your problem, it needs to be more, with sqlplus and some other scripts checking the values in the columns, if it's not null then set an operator, and in the end (in sqlplus)
    select operator1, operator2 etc. from mytable.
    Hope it helps,
    Michael.
    [All the above presented is based on the fact that you shall always have TWO rows to be compared, having more or less it will fail!]
    Message was edited by:
    kjt

  • How to find the difference between Mannual clearing and Automatic clearin

    Hi
    Can any one suggest how to diffrentiate the documents which are cleared manually and which cleared Automatically.
    Thanks and Regards
    Anand

    Hi
    Normally documents posted manually and automatically will have different document types and document number ranges.  For manual clearign we use KZ and in case of auto clearing we use ZP
    Thanks!
    Rajesh

  • How to find the difference between two timestamp column

    Dear All,
    please Solve my issue,
    I have Table name Record which has the following columns,
    Empid in number column, dat in timestamp
    which has the following values
    Expand|Select|Wrap|Line Numbers
    empid dat
    ====== ====
    101 4/9/2012 9:48:54 AM
    101 4/9/2012 9:36:28 AM
    101 4/9/2012 6:16:28 PM
    101 4/10/2012 9:33:48 AM
    101 4/10/2012 12:36:28 PM
    101 4/10/2012 8:36:12 PM
    101 4/11/2012 9:36:28 AM
    101 4/11/2012 4:36:22 PM
    Here I need to display the following columns,
    empid,min(dat) as start,max(dat) as end and difference(max(dat)-min(dat) for each day,
    for eg,
    Empid Strart end difference
    101 4/9/2012 9:48:54 AM 4/9/2012 6:16:28 PM 8.28
    like this.
    Here 3 different days are exists so It should return 3 records with the above mentioned columns,
    Please Help me to get this.
    Thank you,
    Regards,
    Gurujothi
    Edited by: Gurujothi on Apr 25, 2012 4:45 AM

    >
    101 4/9/2012 9:48:54 AM 4/9/2012 6:16:28 PM 8.28
    >
    why 4/9/2012 9:48:54?
    why not 4/9/2012 9:36:28 AM ?
    SQL>
    SQL> with t as
      2  (select  101 empid, to_timestamp('4/9/2012 9:48:54 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      3  select 101, to_timestamp('4/9/2012 9:36:28 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      4  select 101, to_timestamp('4/9/2012 6:16:28 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual union all
      5  select 101, to_timestamp('4/10/2012 9:33:48 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      6  select 101, to_timestamp('4/10/2012 12:36:28 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual union all
      7  select 101, to_timestamp('4/10/2012 8:36:12 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual union all
      8  select 101, to_timestamp('4/11/2012 9:36:28 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      9  select 101, to_timestamp('4/11/2012 4:36:22 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual
    10  )
    11  select empid, min(dat) as start_dat
    12  , max(dat) as end_dat
    13  , max(dat)-min(dat) diff
    14  from t
    15  group by empid, trunc(dat)
    16  /
         EMPID START_DAT                                         END_DAT                                           DIFF
           101 04.09.12 09:36:28,000000000                       04.09.12 18:16:28,000000000                       +000000000 08:40:00
           101 04.11.12 09:36:28,000000000                       04.11.12 16:36:22,000000000                       +000000000 06:59:54
           101 04.10.12 09:33:48,000000000                       04.10.12 20:36:12,000000000                       +000000000 11:02:24
    SQL>

  • Finding the difference between 2 ArrayCollections (like java?)

    Hi,
    In java you can do a 'diff' between two Lists like this:  myList_new.removeAll(myList_old);  This removes from myList_new all the items identical in myList_old
    Is there something similar in Actionscript or do I have to use brute force (loop thru both ArrayCollections and compare) ? My guess is that brute force is required since actionscript doesn't have generics but I'd love to be proved wrong !!!
    thanks!

    If your objects have a unique identifier on them you could do something like below.
    Notice I use value.id as an assumption that "id" is the name of the identifier.  If you have a differently named identifer, you would need to change "id" to that name.
    If there is no unique identifier on your objects, I think you'll just have to loop through the Collections and compare the attributes manually.
    public function removeAll(collection1:ArrayCollection,
                        collection2:ArrayCollection):ArrayCollection{
      var dictionary : Dictionary = new Dictionary(true);
      var value : Object;
      var i:Number
      //Loop through first collection and put objects in dictionary
      for(i = 0; i < collection1.length; i++){
        value = collection1.getItemAt(i);
        dictionary[value.id] = value;
      //Loop through second collection and remove objects in dictionary
      for(i = 0; i < collection2.length; i++){
        value = collection2.getItemAt(i);
        if(dictionary[value.id] != null){
          delete dictionary[value.id];
      var unique:ArrayCollection = new ArrayCollection();
      //Loop through dictionary and put remaining value in collection
      for(var prop:String in dictionary){
        unique.addItem(dictionary[prop]);
      dictionary = null;
      return unique;

  • How to find the difference in object definition between two databases

    Hi,
    Can any one suggest me how to find the difference in object definition between two different databases. Is there any tool or by OEM? If so how?
    Regards
    Naveen

    this link may be helpful...
    http://www.dbspecialists.com/scripts.html

  • How to find outthe difference between the two serivce patch of Netweaver04s

    Hi,
    We have installed NetWeaver04s with sp13 patch. We want to upgrade this to latest patch avaiable on sap market place. I could see sp22 is the latest patch. I know all the procedure to download the patch. But before downloading I have to find out the difference between the latest patch available i.e. SP22 and the current patch installed i.e. SP13.
    Could anybody guide me how to see the difference between any two patches avaiable on the SAP market place?
    Let me know if you need more information on this.
    --Chandan

    Hi
    For single patch info, if you click the INFO link in window from where you download the patch. You will get the information related to that patch.
    eg
    SAPJEE05_0-10003469.SCA SP05 for SAP J2EE Engine 7.00  0 Info 53976 14.12.2005
    Try out this, can help you (some navigation required)
    http://service.sap.com/sp-stack
    Select your Product:
    Select Source and Target Release and Componenets. Click Next
    Navigate under "Additional Information"
    eg:
    SAP NetWeaver 7.0 (2004s) Support Package Stacks
    can be found on the SAP NetWeaver 7.0 (2004s) Support Package Stacks Info-Pages for each available Support Package Stack
    In the next window; again navigate further: you can find like this
    New functionality available with the relevant SP Stack is described in Section "Release Notes" as part of the SAP Library. Please refer to SAP Help Portal -> SAP NetWeaver 7.0 -> Release Notes. Each scenario folder contains the new functionality available for each SP Stack.
    eg.
    http://help.sap.com/saphelp_nw04s/helpdata/en/5b/8c3842bb58f83ae10000000a1550b0/frameset.htm
    This would give you information of changes in different releases.

  • 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

  • Find the difference between two columns in an ssrs matrix ? MSCRM

    Hi All,
    I am working in reporting part of our project (On-line MSCRM 2013) & in reporting services.
    I am trying to create report using fetch xml based. Below is the snap what we required the result.
    Kindly help me, how to get the difference in both column. (Its a matrix table where year is grouped).
    We need difference between both year Like (Plan Revenue of 2013 & Plan Revenue of 2014 difference in Plan Revenue Diff section) and same for Actual
    Revenue.
    https://social.microsoft.com/Forums/en-US/054d5ca4-0d38-4dc6-84a8-88866cc228fe/find-the-difference-between-two-columns-in-an-ssrs-matrix-mscrm?forum=crmdevelopment
    Thanks,
    Mohammad Sharique

    Hi Bro,
    I used parametrized option for year and done the report,Currently we are getting values in Difference column now i want to show
    that value in percentage. How can we show the percentage based on that value. Means i want to show the Difference in Percentage. 
    Kindly help me i tried but getting some issue. Below i am mentioning the code and snap with result.
    Below expression using to showing Plan Revenue in Percentage for year.
    =
    Sum(IIF(Fields!new_year.Value =Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
    - Sum(IIF(Fields!new_year.Value =Parameters!EndYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
    /IIF(Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))>0,
    (Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0))))
    ,1)
    )*100))
    Result issue is as below in snap with highlighted in red colour.
    Kindly help me on this issue also :)

Maybe you are looking for

  • MDB behavior with Foreign JMS Provider

              I am experiencing some MDB behavior which I do not quite understand. I would appreciate           if someone could tell me what might be happening.           An application on WebLogic 8.1 SP1 (also tried it with SP2) has MDB's which listen

  • Assigning a value to a global binding

    I'm using a Global binding for a header field called ReportClassification. It ensures that if the user changes the value of the field, all the fields will be kept in sync. How do I pre-assign a value to the global so that the fields wil be pre-popula

  • CSM probe debugging

    Hi, i've tried to debug a non-scripted probe on my csm, but i can't see any output. What does the message "Health Monitor quiet mode: output error messages" mean, and how can i make those messages visible? TIA, Stephan

  • Rss reader for systray

    Started working on a little project. An rss reader that sits in the systray. Its pretty bare right now, but its downloading feeds and opens them in the browser when i click on them. http://i.imgur.com/ldvS3.jpg -- mod edit: read the Forum Etiquette a

  • Numeric Control Disable

    Hi, I have a numeric control. I want to disable the option of having the user enter a number and hit enter. I only want them to be able to use the up and down arrows to change the control. Is this possible and how do i implement this? Thanks!