How to set just hour and minute to a Calendar object and do comparsion

hi there
can anyone show me how to just set the time : hour and minute to a calendar obj and do comparion? for instance, compare mid night with 7:24pm, how do i create objects to do it? thanks

Or I'll just post them here to save the trouble...
    Calendar xmas = new GregorianCalendar(1998, Calendar.DECEMBER, 25);
    Calendar newyears = new GregorianCalendar(1999, Calendar.JANUARY, 1);
    // Determine which is earlier
    boolean b = xmas.after(newyears);            // false
    b = xmas.before(newyears);                   // true
    // Get difference in milliseconds
    long diffMillis = newyears.getTimeInMillis()-xmas.getTimeInMillis();
    // Get difference in seconds
    long diffSecs = diffMillis/(1000);           // 604800
    // Get difference in minutes
    long diffMins = diffMillis/(60*1000);        // 10080
    // Get difference in hours
    long diffHours = diffMillis/(60*60*1000);    // 168
    // Get difference in days
    long diffDays = diffMillis/(24*60*60*1000);  // 7

Similar Messages

  • How to set multiple ORACLE_HOME and ORACLE_SID, on Windows

    How to set multiple ORACLE_HOME and ORACLE_SID, on Windows.
    I have 5 oracle instances. Every time if i want to start up the services , I am manually setting the environment variable (ORACLE_HOME and ORACLE_SID) and starting the services one at a time.
    Can we set multiple ORACLE_HOME and ORACLE_SID in Start->My computer-> properties-> advance-> Environment variable.
    Thanks
    Naveen

    Hi ,
    Can you please give me the link, for the doc you are referring to
    Thanks
    Naveen

  • Since the last update, my apple tv  can t set the hour and apple id is not recognize..

    Hello,
    since the last update, my apple tv can set the hour and doesn t recognize my apple id.
    i try to set To change DHCP to manual and reverse it s the same..
    i restore it on network twice and with itunes and the problem is not solve..

    Welcome to the Apple Community.
    Assuming this is not the first time you have used your Apple TV
    You might try restarting the Apple TV by removing ALL the cables for 30 seconds.
    Also try restarting the router. (Also try removing it’s power cord for at least 30 seconds)
    If the problem persists, try a restore, you may want to try the previous procedures several times before doing this.
    If restoring from the Apple TV doesn't help, try restoring from iTunes using a USB cable.
    If this is a new Apple TV, in addition to trying the above, it may also be that your network router is not allowing access to the timeserver, check that your router allows access over port 123.

  • HT4972 Can you update your iPhone with firmware V 4.2.1 to v5. If so, How. I just tried  and it did nothing bu mess things up.

    Can you update your iPhone with firmware V 4.2.1 to v5. If so, How. I just tried  and it did nothing bu mess things up.

    Greg434 wrote:
    I'm screwed.  Time for a new phone. Model # A1242 plain old 3G. Thank you for your assistance Michael.
    Well, you're timing is perfect then   Are you eligible for any upgrade pricing from your service provider?
    I skipped over the iPhone 4s, and I am eligible for full upgrade pricing in almost exactly one month from yesterday, so I will be moving to an iPhone 5 next month.

  • How to set the IP and MAC address in C program?

    My working environment is Sun250 Server, Solaris 7 operating system. I encountered a problem ---- How to set the IP and MAC address in C program to make the system change it IP & MAC at runtime?
    Any idea is welcome! Thanks!

    Hi
    As a simplest possible solution, you can use the system command
    to run ifconfig that can set both the mac address and the IP address of the system. You will have to use setuid though.
    Or you can use the DLPI calls ( do a man DLPI or search for a
    Sun documentation on the same at http://soldc.sun.com) to write
    a pure C program.
    HTH
    Shridhar

  • How to set default currency and Country in R12 financial modules

    Hi all,
    How to set default currency and Country in R12 financial modules (AR,AP,GL,FA,CE) becuase I found some default settings are shown "USD" & "United States" such as create AR Customer, the Country is shown the default "United States"....
    Can anybody advise ?
    Thanks & Regards,

    Hi,
    Change the below profile for the user to a territory different than the US :
    In System Administrator, navigate to Profiles -> System.
    Select Site, Application, and Responsibility.
    Profile options:
    Default Country
    HZ: Reference Territory
    ICX: Territory
    Regards,
    Raju.

  • How to set the WIDTH and ALIGN of h:column in h:dataTable ??

    How to set the WIDTH and ALIGN of <h:column> in <h:dataTable>??
    Thanks a lot!

    Hi,thanks to your reply.
    Now I find a more convenient appraoch to set column's width and align respectively:
    <h:dataTable ...>
    <h:column>
    <f:facet name='header'>
    </f:facet>
    <h:outputText style="width:80px; text-align: right;" value='#{row.fieldA}'/>
    </h:column>
    <h:column>
    <f:facet name='header'>
    </f:facet>
    <h:outputText style="width:120px; text-align: left;" value='#{row.fieldB}'/>
    </h:column>
    </h:dataTable>
    It works fine.
    ^-^

  • How to set the router and play the Command & Conquer using direct IP mode?

    My router is WRT54GFirmware Version: v3.03.1
    How to set the router and play the Command & Conquer using direct IP mode with other computer?

    Hi, when you say direct IP mode, what do you mean ? do you wanna play the game online or on the LAN ??
    can you give a few more details.

  • How to set the gain and input coupling for each channel on a NI 4462 DaQ card?

    I've seen a few examples in how to set the gain for NI 4462, but none tell me how to chose the channel I wish to set this gain.  Also the same problem with input coupling
    Does anyone know how to set the gain and input coupling for each individual channel?
    Thanks,
    Hector
    LabView 8.5 Windows XP

    Hey Hector,
    http://forums.ni.com/ni/board/message?board.id=100&thread.id=1688
    This has a few examples of how to do that.  Let me know if you have further questions.
    Have fun!
    -gaving

  • How to set the Mail and Fax options  for the Smartforms ???

    How to set the Mail and Fax options  for the Smartforms ??? Please reply me very soon. Its a life deciding question now for me. Please .

    >
    veera Karthik wrote:
    > How to set the Mail and Fax options  for the Smartforms ??? Please reply me very soon. Its a life deciding question now for me. Please .
    Hi
    Check this Link:
    http://help.sap.com/saphelp_nw04/helpdata/en/a5/28d3b9d26211d4b646006094192fe3/frameset.htm
    P.S: Never say reply me soon....people answer you here voluntarily and as everyone has their own desk to manage...sp replies may late or early..depending upon the availabality of the members.
    Vishwa.

  • How to set input delay and output delay when source Synchronous

    ClkIN is the board clock which is connected to the FPGA. Clkif is the generated clock from ClkIN. The Device's clk come from Clkif. So, how to set input delay and output delay in this scene(within my understand, this is Source Synchronous)?
    The example in many document, the input delay and output delay setting all refer to board clock(within my understand, this is System Synchronous). In that scene, the input delay max = TDelay_max + Tco_max; input delay min = Tdelay_min + Tco_min; the output delay max = Tdelay_max + Tsu; output delay min = Tdelay_min - Th.
    So, I want to know how to set input/output delay in the Source Synchronous.
    In system synchronous, I set input/output delay such as:
    create_clock -period 20.000 -name ClkIN -waveform {0.000 10.000} [get_ports ClkIN]
    create_generated_clock -name Clkif -source [get_pins cfg_if/clk_tmp_reg/C] -divide_by 2 [get_pins cfg_if/clk_tmp_reg/Q]
    create_clock -period 40.000 -name VIRTUAL_clkif //make virtual clock
    set_input_delay -clock [get_clocks VIRTUAL_clkif] -min 0.530 [get_ports DIN]
    set_input_delay -clock [get_clocks VIRTUAL_clkif] -max 7.700 [get_ports DIN]
    set_output_delay -clock [get_clocks VIRTUAL_clkif] -min -0.030 [get_ports DOUT]
    set_output_delay -clock [get_clocks VIRTUAL_clkif] -max 1.800 [get_ports DOUT]
    *******************************************************************************************

    So, first. Architecturally, the clock that you forward to your external device should not come directly from the clock tree, but should be output via an ODDR with its D1 input tied to logic 1 and the D2 tied to logic 0. This guarantees minimal skew between the output data and the forwarded clock.
    ODDR #(
    .DDR_CLK_EDGE("OPPOSITE_EDGE"), // "OPPOSITE_EDGE" or "SAME_EDGE"
    .INIT(1'b0), // Initial value of Q: 1'b0 or 1'b1
    .SRTYPE("SYNC") // Set/Reset type: "SYNC" or "ASYNC"
    ) ODDR_inst (
    .Q (Clkif_ff), // 1-bit DDR output
    .C (ClkIN_BUFG), // 1-bit clock input
    .CE (1'b1), // 1-bit clock enable input
    .D1 (1'b1), // 1-bit data input (positive edge)
    .D2 (1'b0), // 1-bit data input (negative edge)
    .R (rst), // 1-bit reset
    .S (1'b0) // 1-bit set
    OBUF OBUF_inst (.I (Clkif_ff), .O (Clkif_out));
    This generates an output clock that is the same frequency as your input clock. This is consistent with your drawing, but inconsistent with your constraints - is the forwarded clock a 50MHz clock or a 25MHz clock?
    I will assume your ClkIN goes to a BUFG and generates ClkIN_BUFG.  Your first constraint generates a 50MHz clock on the ClkIN port which will propagate through the BUFG to (among other places) this ODDR.
    create_clock -period 20.000 -name ClkIN -waveform {0.000 10.000} [get_ports ClkIN]
    Assuming your forwarded clock is supposed to be 50MHz, then your 2nd command is close to correct
    create_generated_clock -name Clkif -source [get_pins cfg_if/ODDR_inst/C] -combinational  [get_pins cfg_if/ODDR_inst/Q]
    With this done, you have successfully described the forwarded clock from your design. This is the clock that goes to your device, and hence should be the clock which is used to specify your input and output constraints.
    set_input_delay -clock [get_clocks Clkif] -min 0.530 [get_ports DIN]
    set_input_delay -clock [get_clocks Clkif] -max 7.700 [get_ports DIN]
    set_output_delay -clock [get_clocks Clkif] -min -0.030 [get_ports DOUT]
    set_output_delay -clock [get_clocks Clkif] -max 1.800 [get_ports DOUT]
    If you want to get fancier, you could try adding a set_clock_latency to the forwarded clock to account for the board propagation of the clock
    set_clock_latency -source TDtrace2 [get_clocks Clkif]
    (But I haven't experimented with clock latency on a generated clock and I don't know for a fact that it works).
    Avrum

  • How to set user preferred timezone in OBIEE for all objects.

    How to set user preferred timezone in OBIEE for all objects based on users TZ(may be from @{session.timeZone}). without changing My Account -> Preferences

    Check
    Time Zone Specification from http://docs.oracle.com/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#4535403
    just in case https://blogs.oracle.com/xmlpublisher/entry/how_to_keep_your_dates_from_go

  • How to set the selectedIndex when dataProvider is an XML object in DropDownList?

    dataProvider was an XML object
    How to set the selectedIndex when dataProvider is an XML object in DropDownList?
    I do this:
    <s:DropDownList id="dropDownList" requireSelection="true" selectedIndex="2"
                    labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
    But always the first item is selected whatever the value of selectedIndex equals to.

    if i understand correctly, you want the selectedindex to be 2 when the DropDownList  displays.
    It might be the case that the dataprovider is being sought after it's already selected its index (as the dataprovider isn't already determined to begin with), so currently it's
         - setting the selected index to default
         - setting the selected index to 2 (your command)
         - getting the dataprovider
         - setting the selected index to default
    try writing a function to set the DropDownList's selected index after it's received the information, or even just attach it to the employeeService result handler.
    for quick testing sake you could just add
    <s:DropDownList id="dropDownList" requireSelection="true" updateComplete="dropDownList.selectedIndex = 2"
                    labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
    to see if my theory is correct.

  • How to set buildID.xml and custom.properties in SDK

    Hello,
    I just completed a new build deployment of SAP ME5.2, because after I deployed the new version, I don't think I have set a
    correct version number.Can you someone give me a sample how to set the buildID.xml and custom.properties? I am a new on the SAP ME5.2
    The Base version is ME_Base_5.2.5.16.5_netweaver-71_Update.zip and
    MEClient_Base_5.2.5.16.5_netweaver-71_Update.zip. the HB customzation
    version is ME_xxxxxx_2.0.0.0.x_netweaver-71.
    Within the sap note 1484551, you mentioned we need change the
    SDKInstallDir/build/buildID.xml file, here is the context of the file:
    buildID.xml -
    <?xml version="1.0" encoding="UTF-8"?>
    <buildID xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <customer>XXXXXX</customer>
    <revision>1.0.0.0</revision>
    <build>1</build>
    </buildID>
    buildID.xml -
    1. how can we change the revision and build?
    There is another file BuildToolDir/build/script/custom.properties, here
    is the file context:
    custom.properties----
    This file contains build properties used to configure the build
    system.
    The name of the software vendor implementing the customizations.
    vendor.name=xxxxxxxxx
    Vendor build identifier. This value is used to uniquely identify
    customizations built by a particular vendor for a particular customer
    and base
    application version.
    This is also used in path locations and in naming certain build
    artifacts, like the custom EJB module and the utility classes archive.
    vendor.id=xxxxxxxxx
    The installation of the J2EE engine installed in the development
    environment.
    ex. C:/usr/sap/CE1\J00
    j2ee.instance.dir=J2EEInstanceDir
    The web context path used to access the main web application. This
    is used by the build to set the
    context-root value in application.xml after an update has been
    imported.
    web.context.path=
    The web context path used to access the production XML interface web
    application. This is used by the build to set the
    context-root value in application.xml after an update has been
    imported.
    xml.context.path=
    The web context path to access resources from the web extension
    application, like images and work instruction HTML files.
    web-ext.context.path=web-ext
    The target database vendor. Valid values are 'oracle' or 'sqlserver'.db.vendor=ORACLE
    The JDBC driver configured for the application server.
    db.drivername=VMJDBC
    JDBC connection propertes for the WIP (Work In Process) database.
    This is the primary application database.
    db.wip.driverclassname=
    db.wip.driver.url=
    db.wip.host=
    db.wip.port=
    db.wip.sid=
    db.wip.user=
    db.wip.password=
    JDBC connection propertes for the ODS (Open Data Store) database.
    This is the offline reporting and archiving database.
    db.ods.driverclassname=
    db.ods.driver.url=
    db.ods.host=
    db.ods.port=
    db.ods.sid=
    db.ods.user=
    db.ods.password=
    Flag indicating whether to add DPMO NC codes to NC idat files when a
    new update is imported. This value is initially
    set by the installer according the the user selection.
    dpmo.nc.codes=
    The default locale used by the production system. The default locale
    is the locale used to display locale
    specific text and messages when the requested locale is not
    available. This property does not need to
    be set if the default locale is english.
    default.locale=en
    Used when running the build from Eclipse to locate the java compiler
    used by the WebLogic EJB compiler.
    jdk.home=C:/Program Files/Java/jdk1.5.0_20
    Compiler debug mode. If set to 'true', debug symbols will be
    compiled into the byte code.
    compile.debug=true
    Keystore alias
    security.alias=xxxxx
    Keystore password
    security.storepass=ChangeIt
    Key password
    security.keypass=ChangeIt
    Keystore type (jks=default,jceks,pkcs12)
    security.storetype=jks
    Optional source control build identifier that is to be displayed with
    standard version information.
    scs.build.ID=
    Optional extended version information to be displayed with standard
    version information.
    ext.info=
    custom.properties----
    2. How can we change this here?
    Regards,
    Leon Lu
    Edited by: Leon Lu on Aug 4, 2011 11:14 AM
    Edited by: Leon Lu on Aug 4, 2011 11:21 AM

    Hi,
    I created one request with logo in the header an page in the footer etc. and called StyleSheet. After you can import this formats by each request.
    You can do this in compound layout.
    Regards,
    Stefan

  • How to set a bit and leave it

    The company I work for recently took over tech support for a SCADA PC that has Lookout 6.1. Our customer is a small town's Utilities department.
    A new pumphouse communicates back to the Public  Utilities SCADA PC using radio ethernet.  We've found that when setting command bits (Ack alarms, Reset alarms, disable/enable alarms, manual/auto mode  change) the radio transmission introduces a delay factor.  However, when  clicking a pushbutton object to set a bit, Lookout resets the bit  almost immediately and long before the remote pumphouse PLC receives the  command.
    I've looked at and tried the .snapdelay option, set  the pushbuttons to latch their outputs, and examined the Lookout.ini settings but have not  achieved the desired result.  I want to set a bit high with a pushbutton, and leave it high until (optonally) logic in the PLC resets it back to zero. The opposite action would also be desireable, set and stick 0 from a 1 state. In this way, the action would be like a true toggle.
    I want  Lookout to just get out of the way and not manipulate the output at  all: accept the set bit and leave it  alone completely. I checked the sample  applications, NI website knowledge base and discussion groups, but nothing comes  close to explaining how to set and leave a bit in Lookout. Flip-flop objects, one-shot objects and the .snapdelay feature are not suitable to this purpose. Why does Lookout not contain a simple toggle capability?
    Can anyone please advise me of a method that will provide what I need?
    pb-edm

    Thank you for the suggestion.
    The radio delay I'm working with is about 2 to 5 seconds, sometimes a little longer.
    I was at the customer's site earlier this week and tried several things.  Almost nothing worked.  I noticed a while ago that a SnapDelay of 0 does NOT disable it on any of the pushbutton objects I created in the app. 
    I did see in the Lookout Readme Notes file that the unwanted snapback behavior when using remote connections has been a "feature" since version 6.0.  The readme contains several possible workarounds, none of which work (as mentioned in my original post). 
    A set of configurations I found in another application worked for half the objects I newly created, and did not work for the other half -- about 15 objects in total, all pushbuttons.  In the pushbutton object properties, I set connections for .enable, .resetvalue and .value to the remote PLC address. When the pushbutton object is clicked, the desired value is forced continuously until a change of state is registered in the PLC.  But like I said, it only works about half the time.
    Obviously this IS a bug.  I'm hoping Lookout pulls up its socks and issues a patch.  We don't have ours/our customer's time to waste on something that is accomplished without a second thought in other products.
    -pb-edm

Maybe you are looking for

  • Expression at a specific time

    Hi, when I apply an expression it starts from the beginning of the composition, but if I want to start it, for example, after 10 seconds, how can I? Sorry for my english.

  • Pen tool and masking in cs6.

    In previous versions I could create a custom (vector) mask using the pen tool in 2 easy steps. Draw a shape then drag that shape to the image i wanted the mask on. Done. This "feature" has been removed from CS6 and its extremely annoying. Or has it j

  • Importing Video via AEBS

    Three basic question: 1. Is it possible to import video from a camcorder into iMovie via AEBS simply (similar to connecting via USB)? 2. Can the hard drive in my camcorder (MS-DOS fat32) be reformated without screwing up the the way the camcorder wor

  • Unhide photos on iphoto

    I would like to know how to unhide my photos on iphoto. i am currently using a macbook pro.

  • Regd Java.sql package

    Hi all i want to know whether java.sql package will be automatically installed when i install jdk1.5 otherwise i have to install is separately with java 3.0api for that package. plzzzz any body help me regd this.