How to get duration time

Hi all,
I have problem how to get duration time between 2 date time (calendar):
example :
Calendar startDateTime
Calendar stopDateTime
how to get :
???? duration = stopDateTime - startDateTime
Thanks before

     Calendar one = new GregorianCalendar();
     Thread.currentThread().sleep( 1000 );
     Calendar two = new GregorianCalendar();
     long time = two.getTimeInMillis() - one.getTimeInMillis();
     System.out.println( "Hrs   " + Math.round( time / ( 1000 * 60 * 12 ) ) );
     System.out.println( "Mins  " + Math.round( time / ( 1000 * 60 ) ) );
     System.out.println( "Secs  " + Math.round( time / 1000 ) );     
     System.out.println( "MSecs " + time );

Similar Messages

  • Just bought Photoshop Elements 13...I'm trying to make a slideshow but can't figure out how to alter duration time that the slide is on the screen.  They presently move from one to another way too quickly...also need a different pan and zoom option.  Wher

    Just bought Photoshop Elements 13...I'm trying to make a slideshow but can't figure out how to alter duration time that the slide is on the screen.  They presently move from one to another way too quickly...also need a different pan and zoom option.  Where are all the options I had in PS10?  Also...Can I burn this to a DVD?

    The changes have brought improvements but also drawbacks compared with the old slideshow editor.
    The templates are now fairly fixed but I find the “Classic Dark” gives reasonable results with some panning and you can click the audio button and browse you PC for any track. Unfortunately there are only three speed choices linked to the music track. The improvement for most people is that you can now export to your hard drive at 720p or 1080p and upload to sites like YouTube and Vimeo.

  • How to get current time and date??

    How to get current time and date from my PC time and date to the java application??
    i use java.util.* package but got error, that is:
    - java.util.* and java.sql.* class are match
    - abstract class cannot be instantiated
    so what can i do, pls guide...thanks...

    There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
    Don't import *. Import the specific classes you need.
    Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother.

  • How to get server time in Oracle Internet Directory (OID)?

    Hi,
    How to get current time on OID server? As in case AD, RootDSE contains currentTime attribute, Is there any attribute in OID through which I can get current time on server.
    Thanks in advance for any help.
    Regards,
    Umesh

    Hi,
    wrong forum, use Identity Manager
    Frank

  • How to get a time from a NTP server in ActionScript 3 ?

    Dear All,
    I need your advice, how to get the time from NTP Server , I tried to do this, but I don't.
    Thanks
    Omar Mahmoud

    you must use a server-side language supported by your server.  php is a commonly supported language on most servers.
    php tutorials can be found via google or any other search engine.

  • How to get the time interveral for each status of worklow (wating,Inprocess

    Hi Friends,
    I have requreiemnt to get the time interval for each status of workflow.
    ex.
                                                                     status
    workflow id  | startd date | enddate       | waiting | Inprocessing|Error|......
    1026            10.10.2008  25.10.2008        1hr      1hr 30 min    2 hr
    Please do give me idea how to get the time stam of each status of workflow.
    Thanks,
    D.prabhu

    Hi,
    I think the following tables would be helpful to you:-
    SWW_CONT     Container Contents for Work Item Data Container
    SWW_CONTOB     "Container Cont. for Work Item Data Container (Only Objects)"     
    SWWLOGHIST     History of a work item     
    SWWORGTASK     Assignment of WIs to Org.Units and Tasks     
    SWWUSERWI      Current Work Items Assigned to a User     
    SWWWIHEAD     Header Table for all Work Item Types
    Hope it Helps!
    Regards,
    Kanika

  • How to Get Duration, Start/Stop Time of Each Instance (Run)

    Can someone tell me how to get the Duration, as well as Execution Start/Stop times for a given run (Instance) of a Report, stored in History?
    For example, on the BO Server in InfoView, I can browse the History of each report, and for each run, I can click the details and view the Duration and Start/Stop times for that run. How do I get that information in Java via the SDK?
    Neither IProcessInfo nor ISchedulingInfo seems to have this information.
    For example, ISchedulingInfo's Start/Stop Times are for general scheduling (when the report will stop being scheduled). That is not what I want.
    I need specific data for a given completed Run, namely its duration and time endpoints. Thanks a lot.

    Hi,
    fetch the instance of the run like this
    IInfoObjects list = infoStore.query(
    "select SI_STARTTIME , SI_ENDTIME From CI_INFOOBJECTS Where SI_ID=<instanceIDtoMeasure>"
    IInfoObject element = list.get(0);
    Date startTime = element.properties().getDate("SI_STARTTIME");
    System.out.println("Beginn "+ startTime);
    Date endTime = element.properties().getDate("SI_ENDTIME" );
    System.out.println("End " + endTime);
    long time = ((endTime.getTime() - startTime.getTime()) / 1000);
    System.out..println("Runtime " + time + " sec");
    You can get the nstanceIDtoMeasure form your Report with getInstances
    Enjoy
    johannes

  • How to get elapsed time in case struture?

    I'm trying to get Elapsed Time VI to work but couldn't figure out how to use it properly.
    I have a subVI with state machine structure to decode data stream from serial port.
    State1 uses VISA read to read a byte and check if it is the Start of Frame. If TRUE, goes to State2. If FALSE, loop back to State1 and try again.
    If the State1 keeps getting FALSE for certain time (e.g. 5 seconds), stop the subVI and insert custom error code.
    So I have to calculate the elapsed time since State1 starts to be FALSE and keeps to be FALSE.
    I tried to use Elapsed Time VI but have problem of understanding it well.
    Is there any other better solution than using Elapsed Time VI? Also, how long is the execution time of Elapsed Time VI?
    Any suggestion will be very much appreciated.

    Hi,
    The Boolean output (Time Elapsed) in Elapse Time VI should give True when time got elapsed.
    Else we can simulate using "Tick Count (ms)", which counts the ticks in milisecond. You can move on to state 2 when count reaches to reauired duration.
    We can give you better idea if you post the code VI.
    Regards
    Haneef

  • How to get system time from cRIO?

    Hello,
    I have an NI cRIO-9076 chassis with an NI-9467 GPS module and an NI-9234 module.
    I've downloaded the FPGA Timekeeper application which synchronises the FPGA clock to the 1PPS GPS, this works well.  What I want to do is create a trigger that at a pre-defined HH:MMS the system will start to acquire and log data from the Accelerometers connected to the NI-9234 module.
    I have added the controls for the entry of the HH:MMS and calculated the time in seconds.  I would like to compare the system clock once it is locked to the entered timestamp and then trigger.
    As I only have a value that represents seconds in the day I need to calculate the offset from EPOCH to compare against the GPS time reference.  I have read that the NI system clock runs from 01/01/1904 instead of the EPOCH 01/01/1970.
    The question is how do I get the current system time so that I can compare it against the entered time?  I only need seconds in the day = (HH * 3600) + (MM * 60) + (SS)
    Thank you,
    Kind Regards,
    Simon

    You should use the Get Date/Time in Seconds VI which will return a timestamp. You can then format this timestamp using the Format Date/Time String to give you exactly the time format that you need. Then you can extract the numbers you need and do your math.
    www.movimed.com - Custom Imaging Solutions
    Attachments:
    Get Seconds in Day.vi ‏9 KB

  • How to get real time information about how many user are logged in and thei

    I use tomcat as my server platform in Ubuntu for a war file.
    I know in order to get real time information about how many user are logged in, we can count how many active sessions exist by a SessionCounter code. However, I have to permit HttpSessionListener in web.xml of tomcat. From other users' experiences, the configuration is complexed and has some errors.
    Here's the link:http://www.stardeveloper.com/article...1112001&page=1
    In order to get users' ip, in jsp, use request.getremotehost() or
    request.getremoteaddress() by editing the jsp file.
    I wonder if there's some open source software to use for these two purposes.
    Thank you!

    That url is missing a few bits. The ... in the middle doesn't help.
    we can count how many active sessions exist by a SessionCounter code.
    However, I have to permit HttpSessionListener in web.xml of tomcat.
    From other users' experiences, the configuration is complexed and has some errors.And have you tried it? The configuration isn't that complex.
    What errors do you mean? Errors in tracking people, variance in the count? Probably related to internet issues and nothing you can do will alleviate them.

  • How to get a time part from Date datatype

    Hi,
    I would like to know how to extract the timestamp alone from DATE datatype? If my input is '27-SEP-2011 23:59:00' I need the output as 23:59:00. I am surprised to see that there are no in-built functions for this or may be I am wrong. Basically I need to remove the date part from DATE data type and get the time.Please assist.
    -Thanks
    Edited by: user9546145 on Sep 27, 2011 2:24 PM
    Edited by: user9546145 on Sep 27, 2011 2:25 PM

    Hi,
    user9546145 wrote:
    Hi,
    I would like to know how to extract the timestamp alone from DATE datatype? Be careful! In Oracle, TIMESTAMP means a datatype, similar to but distinct from DATE. You'll avoid confusion if you don't use the word "timestamp" to mean anything else.
    There is a built-in function, TO_CHAR:
    TO_CHAR (dt_col, 'HH24:MI:SS')Depending on how you plan to use the time, TRUNC is another handy built-in function:
    dt_col - TRUNC (dt_col)is a NUMBER (not less than 0, but less than 1) which is suitable for many tasks, such as finding the average time.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • How to get elapsed time of the query in form 6i

    hi
    I used to use " set timing on " in sql to get the elapsed time
    set timing on
    elapsed time :XX:XX:XX ,
    but i dont know how to get it in fom
    its really imporant to measure the time elapsed for me cuz i am student an need to get the time
    thanx alot

    regarding to point 1 : u know there are three modes for system ; query, enter_qeury,and normal. when the system is not noraml so it is either query or enter_query , and both are query processing ( as i think) so it the elapsed time . it also by using timer stpos when system finish query ( normal)
    why you dont prefer timers ..... ( it important please to explain )
    thank you very much Navnit Punj
    Edited by: user8652693 on 22/07/2009 07:33 ص

  • How to get current time in TimesTen

    I need to get the current timestamp of TimesTen DB located node, how can get it?
    In PSQL, I can use built-in function now(), In Oracle, I can use LOCALTIMESTAMP, thanks. a lot.

    Hi Vikas,
    Firstly, the syntax you give
    select to_char(sysdate,'dd-mm-yyyy hh24:mi:ss.FF') as ts from dual;
    does not work in Oracle DB - it gives an eror due to the '.FF' in the format string.
    This syntax does work just fine in TimesTen (which is a little more tolerant).
    However, this is not a very useful thing since the resolution of SYSDATE is 1 second and to accurately measure data fetch times you need accurate microsecond resolution. Also, you would need to take an average over many millions of measurements to get any degree of accuracy.
    Realistically, this will be a very difficult thing to measure with any accuracy. Might I understand what you are exactly looking to achieve here? For the same amount of data, separateing 'fetch' from SQL execution, TimesTen in direct mode will return data much, much faster than an Oracle client/server connection wven when the client is on the same machine as oracle. For Tt client/server mode the data transfer performance will be very similar to that for Oracle.
    Chris

  • How to get current time

    Hi,
    I would like to know how to get the current time (07H25 for instance).
    Does someone know how to do it ?
    Thanks in advance, Fred.

    java.util.Date = new java.util.Date();
    The above code produces an object which contains a timestamp (date and time) for the instance in which it was created.
    To display it in any format you wish you would use the java.text.SimpleDateFormat class.

  • How to get current time in seconds

    Can someone please tell me how to get the current time in seconds. I am currently doing as follows but not sure if its correct or best way:
    Calendar cal = new GregorianCalendar();
    long currentTimeInSeconds = cal.getTimeInMillis()/1000;

    vik1491 wrote:
    How about this:
    Date date = new Date();
    Format formatter = new SimpleDateFormat("HH:mm:ss");
    String s = formatter.format(date);
    String patternStr = "\\:";
    String[] fields = s.split(patternStr);
    int secondsSinceMidnight= Integer.parseInt(fields[0]) * 3600 + Integer.parseInt(fields[1]) * 60 + Integer.parseInt(fields[2]);
    What about the day what you switch between standard time and daylight savings time?

Maybe you are looking for

  • ITunes no longer plays any sound

    So basically, I logged on yesterday to find iTunes making no sound. I thought it'd just be fixed by resetting the computer, unfortunately, it hasn't. So today I tried uninstalling and reinstalling iTunes. This also has not fixed the problem! I've als

  • Macbook Pro Retina crashes after SMC Reset

    Hey guys. My macbook pro retina is constantly running its fan at full speed at random times. The fan is always running on high even when I do not have any background apps running. And every time I try to perform SMC reset, my macbook crashes and I ha

  • Will 11g have an update & be supporting ejb 3.1 when it is released ?

    I am trying to plan for a project that will require 3.1 to be used.

  • LDAP Datasource

    I have a requirement to attach and use an LDAP Server as a datasource. Given that there is the Foreign JNDI Provider, I was wondering if anyone has used this functionality to create a pool of LDAP connections to mimic a straight jdbc Datasource provi

  • Starting WebRowSet

    I am currently working on a program that uses XML to store data. I am having problems, about how to import the webrowset. It seems I can not find the javax.sql.webrowset class. I am using jdk 1.4.2_04-b04 on JBuilder 9. Can sombody help me. Thanks.