How can i get number of days between two dates represented by two dates?

how can i get number of days between two dates represented by two date objects. One is java.sql.Date, the other is java.util.Date?

tej_222 wrote:
But how do I do that conversion. from java.sql.date and java.util.date to calender?
-thanks for the quick response.You may find the following utility code samples useful:
[http://balusc.blogspot.com/2007/09/calendarutil.html]
[http://balusc.blogspot.com/2007/09/dateutil.html]
ganeshmb wrote:
(date1.getTime() - date2.getTime())/(1000*60*60*24) should do.
getTime returns millsecond value of date object and the difference divided by no of milliseconds in a day should fetch you the difference in terms of days.This doesn't respect the DST. Use java.util.Calendar.

Similar Messages

  • How  can I get number of days between 2 dates ?

    How can I get number of days between 2 dates ?
    Give me answer as soon as possible.....

    Mukesh_Prajapat wrote:
    How can I get number of days between 2 dates ?
    Give me answer as soon as possible.....Is google broken again?
    [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html]

  • How do i get number of days between 2 dates?

    How do i get number of days between 2 dates?
    and the result must be in int.
    for example
    Ex. startdate: 2006-06-01 enddate: 2006-06-30 and the result is: 30
    how to do so? thx

    mel
    Iv'e used this method. It assumes startdate,enddate and days have been defined before but you could pass them as args.
    void days()
        try
          Date d1 = DateFormat.getDateInstance().parse(startdate);
          Date d2 = DateFormat.getDateInstance().parse(enddate);
          long days = (d2.getTime()-d1.getTime())/1000/60/60/24;
          days = ""+days;
        catch (ParseException e)
          System.out.println("Invalid date format");
      }It actually gets the duration in ms and divides down to days.
    Regards
    Chris

  • How can we get the value of the key field in a custom data model using governance API?

    Dear Team,
    How can we get the value of the key field in a custom data model, to be used for manipulation of the change request fields using governance API?
    Any kind of help would be sincerely appreciated.
    Thanks & Regards,
    Tushar.

    Hi Michael,
    Thanks for direction. Let me give more context on this as I'm interested to get more details..One of the issue was to read cross entity field values on UI based on user action and set other entity field behaviour...It is similar to what is being posted here.
    For ex: Reading MTART from Basic Data UIBB in MM MDG UI and set the field properties in some other custom entities say ZZETEST. This cannot be done using UI BADI as it only supports single entity at a time and not cross entity. So alternatively we found a solution where we can enhance existing PLMB feederclass cl_mdg_bs_mat_feeder_form by reading the model and the entity as needed as it it proved that it supports cross entity UI field behaviours and so business requirements.
    This is a workaround for now.
    So the question is How do we achive it using governance API for cross entity field behiaviours.?or what is the right way doing this.
    Can we do that using governance API and its' methods?
    In the Governance API doc you provided below has referring to below external model as part of gevernance API.
    The active or inactive data (before or during the derivation or the check) can be read
    with the external data model interface IF_USMD_MODEL_EXT with the method READ_CHAR_VALUE and
    the corresponding READ_MODE parameter. To avoid unnecessary flushes (derivations), the NO_FLUSH
    parameter should b
    e set to ‘X’.
    Thanks
    Praveen

  • I reinstalled my OS and now it wants to empty my phone.  How can I get it to back up my phone without removing the data?

    I reinstalled my OS and now it wants to empty my phone.  How can I get it to back up my phone without removing the data?

    You can't. But if you backed up your computer prior to wiping it out, you should be able to restore your iTunes library, contacts, photos, etc. from that backup. Once you do, you can set the phone up again and just sync everything from your library back to it.
    If you didn't back the computer up either, you can transfer items purchased on the phone into iTunes, and if you set up at least one contact in whatever application you sync your contacts to on the computer, it will offer to merge the address books on the first sync, saving those.  Any media you'd acquired from sources other than the iTunes store will have to be re-downloaded from the source or re-ripped.
    The iPhone is NOT a backup device.

  • Getting number of days between 2 dates

    Hello All,
    I require the number of days between 2 dates.
    The number of days is between low date : PR Date (not an input variable) and the high date.
    I have created an customer exit variable to get sy-datum in made it as formula variable.
    I have also created a formula variable for PR Date , and subtracted the 2 dates.
    It is not giving the correct result.
    Any suggestions.
    Thanks & Regards,
    VL

    Read through this web link.  It will show you how to calculate the days between 2 dates directly in your BEX query.
    No exit needed to calculate this.
    http://teklink.co.uk/sap/sap-bi-bw-how-to-use-replacement-path-variables-to-perform-date-calculations-in-the-bex-analyzer/

  • Please help how can I get Number of activations changed?

    How can I get my iPads reset for number of activations? I have had an original iPad and two iPad 3 and now 3 iPad Air due to defective tablets.They were replaced for technical issues. I keep getting this message on both devices in BAM2 E_AUTH_BAD_DEVICE_KEY_OR_PKCS12
    I have not even read the book I originally purchased from BAM. Please help.

    They'll know more in the Adobe Digital Editions Forum

  • How can i get my Dashboard sync between two macs?

    I have mabbok pro and imac how can i make this possible??????

    POP accounts can be set up to leave mail on the server. Thus this mail could be accessed from several different computers.
    I used Eudora a while ago, and set up 2 accounts, one left email on the server, and one did not. I would normally check mail from the one that left it on the server (accounts like this on several macs). When I was ready to download the mail, then I would check it from the other account that existed on only one of the macs.
    So in Mail, you could set up for POP and leave mail on the server. Then when ready to download (and not be able to see mail from various macs) you could switch to another user account, where Mail would be set up to not leave mail on the server.
    However, iMap makes this whole process easier.
    Normally, iMap mail can stay on the server forever. But I do like to get my mail and store it on my Mac after an arbitrary period of time. So I have set up a smart rule in Mail.
    It is GET MAIL:
    if Date received is less than 10 days old
    perform the following actions: stop evaluating rules
    So every day the mail is received, and of course it is less than 10 days old, so the rules stop evaluating.
    When I am ready to download the messages I select all in the mailbox, and use command-option-L to apply the rules. Any messages less than 10 days old stay on the server, Older messages then follow the other rules which are listted after GET MAIL. Usually these just filter mail into specific dumb mailboxes on my Mac. And/Or they could color the mail, or whatever else I choose to do with the mail.

  • How can i get icloud to synch between outlook on my pc and my iphone 5?

    I have loaded icloud on my PC and it's on my i5 phone.  However, I can't get my calendar and contacts to synch between my PC and phone.  Any suggestions?

    Make sure to go into your icloud panel on your PC (in control panel) and on your phone (settings) and check everything you want to synch.  Curious to know if this works for you as mine was working perfectly until last week.

  • How can I get a one day development session for experienced developers in Malaysia?

    I have a team of experienced and capable developers in Malaysia.  We have just launched a new product and the guys put in a huge effort to get us there.
    But our product does on work on ipads or iphones because it is largely in Silverlight. So we might build a separate application soon for mobile and apple based devices.
    I would like to reward the guys with a day (or maybe two) where they can learn to program for ipads.  I would like a hands on lab from and experienced developer rather than a basic training course.  I would like the guys to get their hands dirty and play with the technology even if all we get from the day is fun, experimentation and hopefully a taste of a new capability that we could develop.
    I also have usability guys so it would be ideal if we could have a day for them too, but my primary aim is to let the developers tackle something new with no critical deadline or strictly contained business requirements.
    What should I do?  Is there a guru developer who could spend a day with the team?

    Email you care to put here you can share?
    Just long enough to grab and then edit out will be ok.
    Ken

  • How can I get Number of Lines from internal table?

    Hello at all,
    i have in my Report a internal Table, which have many KUNNR.
    For example the internal Table:
    MANDT.......KUNNR......NAME.........FIRSTNAME........CITY
    ...040..........12345.........Owen............Michael........Liverpool
    ...040..........12345.........Owen............Michael........Liverpool
    ...040..........99999.......Johnson.......... Jeffrey........London
    ...040..........12345.........Owen............Michael........Liverpool
    ...040..........55555.......Hardley.......... Kingston.......Birmingham
    I want to know, how many same KUNNR are existing in the internal Table?
    In my example i need the result 3, because their is existing 3 times the Kunnr 12345 in the internal Table.
    Have anyone an idea, how can I resolve this problem?
    Edited by: Thomas Zloch on Jun 21, 2010 2:55 PM - one question mark at a time is sufficient

    Hi,
    1.Create two internal tables of same type and sort according to Kunnr then Delete the
    adjusent duplicates by comparing KUNNR
    2.Sort the table by KUNNR and use ON change of Concept in that Just increment the counter.
    I am writing the sample logic here.
    tables kna1.
    data: t_kna1 type table of kna1,
             w_kunnr type kna1-kunnr,
             counter type i," Holds No.of KUNNRs in the T_kna1
             t_kna2 type table of kna1.
    select * from kna1 into table kna1 up to 100 rows.
    t_kna2[] = t_kna1[].
    delete t_kna2 by kunnr.
    delete adjusent duplicates from t_kna2 by comparing kunnr."1st Method
    read table t_kna2 transporting no-fields.
    counter = sy-tfill."1st Method
    loop at t_kna1 into kna1."2nd Method
    at first.
    w_kunnr = kna1-kunnr .
    counter = 1.
    endat.
    if w_kunnr ne kna1-kunnr.
    counter = counter + 1.
    endif.
    endloop.
    Note : Here I used a sample table KNA1 in this there are no Duplicates of KUNNR .

  • How can I get Firefox to "grab onto" and then "hold onto" the data signal until I tell Firefox to release it at the end of my session of internet browsing?

    ok, I hope that my description of this problem does not come out in such a disorganized fashion that it makes the description difficult to follow. here goes: every 30 seconds to 1 minute (or thereabouts, I'm estimating) my mobile phone's browser (whether Firefox or any other) loses the data signal, so that tje next time that. I click on something, I get an error message that the "data connection timed out, retry" or "network unavailable" or "check that you are connected to that internet", etc. etc. etc. I have downloaded many apps that are supposed to boost data connectivity and/or improve internet speed, blah, blah, blah, till I discovered that was a problem with the server being able to keep up with staying locked onto my browser. in one of these apps diagnostic screens, I found a notation that therr was something wrong with my cell's relative position. well, how could that be, I wondered, since I had "GPS tracking" "GPS reporting" and "location sharing" all enabled? but, then I noticed, on the image of my cell's location as represented by this particular app, that every half minute, or so, the blue dot which represented my cell's location would slip to the left about one quarter of an inch, or so, and in the longitude and latitude part of this app's diagnostic screen I saw that the numerical designations of my cell's longitude and latitude were zero and zero. it suddenly occurred to me that the server had lost sight of my cell because my cell had moved too far out of the range of that server's sight due to the rotation of the earth. well, blow me down, what am I supposed to do to fix that? how can I tell my cell phone's OS to send out some kind of identifying info on a constant basis, so that the server could keep track of it (and I would not lose the signal)? or, conversely, how could I get my cell phone's browser to grab onto the signal and not let go of it until I was done with that internet session, at which time I would then manually release the signal myself? I hope that my explanation of the problem made enough sense that you could follow it and that you can come up with a workable solution for me. oh yeah, my phone is an LG OPTIMUS ELITE 696. thanx, from the enragedkangaroo.

    Hello,
    I'm afraid I don't think there is going to be much we can do to help you here. The description sounds like an issue with the phone rather than with Firefox specifically.
    I don't think the problem can be caused by you moving out of range of the cell, due to the rotation of the earth. The cell towers (that provide phone signal) are sitting on the earth, just like you, and so move at the same speed as you. This might be a concern with satellite phones using Low Earth Obit satellites but this isn't the case here.
    I think the best thing to do would be to get in touch with your Phone Operator or Device Manufacturer for support. If you are out of the support period or can't get support from them for some other reason then a standard 'cure-all' for mobile phones is to do a Factory Reset. This will return your phone to its default factory settings and wipe all of your data / modifications off the phone. This tends to solve most problems and is probably what the official support team would tell you to do. I can't guarantee that it will help but it has a good chance.
    There are instructions on resetting your phone here:
    http://www.hard-reset.com/lg-optimus-elite-hard-reset.html
    I hope that helps.

  • How can I get iCloud to sync between iOS 6.1.3, OSX 10.6.8 and OSX 10.8.3?

    I am running both OSX 10.6.8 and OSX 10.8.3 on my iMac with iOS 6.1.3 on my iPod Touch.
    Everything is checked ON in the iCloud settings where those are available, in iOS, OSX 10.8 and in iCloud.com on my OSX 10.6.8 system.
    I either get no synchronisation, or a duplication of events. Apple Store Events which need to be clumsily downloaded from the website, double clicked on and hopefully added to Calendar, only randomly appear and rarely get announced. I can't see a pattern to anything.
    It currently won't sync between iCloud.com and Address Book, Calendar etc on the Mac let alone with iDevices (my wife has an iPad as well), despite partially syncing previously.
    It is erratic, obscure and totally unreliable as well as being a huge waste of my time.
    If I follow the iTunes instructions as well as the iCloud.com instructions generally nothing happens.
    In the Advanced pane of iCloud.com settings, I have selected the “In-app notifications” checkbox, and Saved. Doesn't work. Then I unselected and saved and closed iCloud.com. Then checked it all over again, still doesn't work.
    According to the settings it says it is sharing with the iPod Touch, but nothing happens.
    Previously a few events appeared belatedly at some later time, often after the event they were supposed to announce. Currently nothing is syncing.
    Most frustratingly I can't sync my Address Book/Contacts so have to manually include all the contact info in all my individual devices and systems.
    Has anybody got a surefire method of making the sync happen?

    Csound1 wrote:
    PeterBreis0807 wrote:
    My take on what is supposed to happen is that the data is stored in Apple's iCloud server no matter how you put it there.
    That's correct but your 10.6.8 machine has no way to put it there unless you manually enter it on the website.
    That to sync data from iCal and Address Book in Snow Leopard to the iCloud server you must manually register and connect to the iCloud.com website which I have done.
    You can't sync from Address Book or iCal in Snow Leopard.
    PeterBreis0807 wrote:
    My take on what is supposed to happen is that the data is stored in Apple's iCloud server no matter how you put it there.
    That to sync data from iCal and Address Book in Snow Leopard to the iCloud server you must manually register and connect to the iCloud.com website which I have done.
    The syncing to the same data in Mountain Lion is done via the System Preferences > iCloud, which I have done.
    Supposedly that means the data on the iCloud server is then shared between the iPod Touch, SL and ML, but it is not.
    Because data entered on the SL machine never makes it from iCal or AB to iCloud or from iCloud to AB or iCal, the link breaks there.. You can use a 3rd party app (Soho) and use it instead of AB and iCal.
    But the problem exists on ML as well.
    I get only some Contacts and iCal events transferring.
    What you are seeing is probably from SL account which I use 95% of the time. Particularly my Address Book entries. I hardly entered any of those in ML, they virtually all come from SL and seem to have transferred previously. Possibly before the latest iOS updates, but I can't swear to that as I didn't check before/after.
    The vast majority of my Address Book entries appear in both iCloud.com and my iPod Touch, but not my latest changes.
    This is far from the "It just happens!" promised by Apple.
    Peter

  • How can I get my iTunes synced between multiple computers?

    I always have the most current version of iTunes and I also subscribe to iTunes Match. Is there anyway to get my computers (both Mac) to have the same iTunes library without deleting all of one library and importing the other to it? As a professional musician, I have way too many songs to constantly do this, and I refuse to believe that Apple hasn't came up with a better solution such as syncing. If anyoe can help me out, it would greatly appreciated! Thanks!

    No.
    Iphone will sync with one and only one computer a a time.  Syncing to another will erase the current content from the iphone and replace with content from the new computer.

  • How can i get number for my 10.6 os

    i am trying to get numbers for my computer and ipad but says i cannot use with out 10.7 OS.  Is there a version for a 10.6 OS system

    Welcome to the Apple Support Communities
    The Numbers version available in the App Store is only compatible with OS X 10.7.5 or later, so you can't purchase Numbers from the Mac App Store.
    Now, the only way to buy Numbers for Snow Leopard is to buy iWork '09 in a DVD from Amazon or eBay and install Keynote, Numbers and Pages. Then, open  > Software Update to install the most recent iWork '09 version for Snow Leopard

Maybe you are looking for

  • Having itunes open when ipod is connected

    Nano 4th generation--iTunes always opened when iPod was connected to computer; now it doesn't and going to Devices and scrolling down Summary to "open when ipod is connected" is greyed out and will not allow me to check it.  Even going to the iTunes

  • How do I get to open a access's form with LabView?

    I know as to send data to access´s table. Now,I would like to open a access´s form with LabView using activeX or other tools. I would like to receive, if possible, a v.i. as example. Thank you ...

  • DBMS_LDAP package documentation and samples

    Where can I find the DBMS_LDAP package documentation and samples to use it to connect to OID from pl/sql blocks. TIA, Nishant

  • Serial Numbers for individual CS2 programs

    i bought this as a teacher student product while in college.  Now that i am graduated back in 2007. i wold like to reinstall this program on my new personal computer.  I was able to install the program but only the Acrobat 8 and Adobe LIveCycle 8 wor

  • General exception error

    hii members, I am getting this error for bi base run time error: GENERAL EXCEPTION IN DEPLOY TRANSFORMATION FOR OBJECT.               Kindly throw some light on to which part is the error from.