What class to use for date manipulation

To get some experience in using Java, I would like to write a small application. I want users to enter their names and birth dates, and then I want to present the number of days they have been walking around on this planet. Furthermore, I want to present the dates when the number of days will be a nice quantity ("On February 1st, 2007 your day age will be 10.000 days", or something like that).
To calculate the number of days, I have to do some date manipulation. Now I am wondering what date-related classes I should use. Of course, there is Date, but in the API specification, I see 'deprecated' for a lot of methods. Does this mean that the use of Date is discouraged, and/or should be avoided?
Then, there is a class Calendar, but that's an abstract class. Thus, I cannot create a Calendar object when a user has entered his birth date (in a Swing JTextField).
The use of GregorianCalendar seems a bit far-fetched to me, but maybe I am wrong.
In short, when a user has entered his birth date, I want to store it in some date-like object, and I want to be able to do some arithmetic based on that object.
Can anyone give me some clues?
Ewout

> The use of GregorianCalendar seems a bit far-fetched
to me, but maybe I am wrong.
Yes, that's the way to go.

Similar Messages

  • What are Wrapper classes and what are they used for ?

    What are Wrappter classes and what are they used for ?..Also, any examples would be great to understand this concept

    Wrapper classes are used to enclose primitive data
    types so that they can be used in instances where an
    object is required. For example, if you want to add an
    integer to an ArrayList, you can't use this:java.util.List al = new ArrayList();
    int i=123;
    al.add(i);because the ArrayList expects data of type object. In
    order to all the integer to the ArrayList, you must wrap
    it in the Integer wrapper class. This works:java.util.List al = new ArrayList();
    int i=123;
    al.add(new Integer(i));Hope that helps.
    Mark

  • HT5287 If DVD Movies, Audio CD's and even burning CD and DVD's are not supported, what is the point of DVD & CD Sharing then? Wouldn't it just be better to remote in or use a thumb drive if it's only able to be used for data transfer?

    If DVD Movies, Audio CD's and even burning CD and DVD's are not supported, what is the point of DVD & CD Sharing then? Wouldn't it just be better to remote in or use a thumb drive if it's only able to be used for data transfer?
    Or am I missing the bigger picture?

    As long as you have a Superdrive or an external burner/drive, burning, watching, installing, etc. from CD or DVD will work just fine. And so will sharing.

  • What are state objects, and what are they used for ?

    tried to find some information in the documentation and internet. but i couldn't find a good explanation with an example what that is and what it is used for.
    thanks for any good answer !

    Wrapper classes are used to enclose primitive data
    types so that they can be used in instances where an
    object is required. For example, if you want to add an
    integer to an ArrayList, you can't use this:java.util.List al = new ArrayList();
    int i=123;
    al.add(i);because the ArrayList expects data of type object. In
    order to all the integer to the ArrayList, you must wrap
    it in the Integer wrapper class. This works:java.util.List al = new ArrayList();
    int i=123;
    al.add(new Integer(i));Hope that helps.
    Mark

  • What is the use for CREATING VIEW WITH CHECK OPTION?

    Dear Legends,
    I have a doubt
    What is the use for creating view?
    A: First Data Integrity, Selecting Particular Columns..
    What is the use for creating a view with check option?
    A: As per oracle manual I read that its a referential integrity check through views.
    A: Enforcing constraints at DB level.
    A: using CHECK OPTION we can do INSERTS UPDATES for a view for those columns who have no constraints... is it right??
    A: If we do a INSERT OR UPDATE for columns who have constraints it will show error... is it right???
    Please clear my doubt's Legends
    Lots of Thanks....
    Regards,
    Karthik

    Hi, Karthick,
    karthiksingh_dba wrote:
    ... What is the use for creating view?
    A: First Data Integrity, Selecting Particular Columns..Most views are created and used for convenience. A view is a saved query. If the same operations are often done, then it can be very convenient to code those operations once, in a view, and refer to the view rather than explicitly doing those operations.
    Sometimes, views are created and used for security reasons. For example, you many want to allow some users to see only certain rows or certain columns of a table.
    Views are necessary for INSTEAD OF triggers.
    What is the use for creating a view with check option?
    A: As per oracle manual I read that its a referential integrity check through views.The reason is integrity, not necessarily referential integrity. The CHECK option applies only when DML is done through the view. It prohibits certain changes. For example, if a user can't see certain rows through a view, the CHECK option keeps the user from creating such rows.
    A: Enforcing constraints at DB level.I'm not sure what you mean. Please give an example.
    A: using CHECK OPTION we can do INSERTS UPDATES for a view for those columns who have no constraints... is it right??No. Using CHECK OPTION, you can do some inserts and updates, but not others. The columns involved may or may not have constraints in either case.
    A: If we do a INSERT OR UPDATE for columns who have constraints it will show error... is it right???If you try to violate a constraint, you'll get an error. That happens in views with or without the CHECK OPTION, and also in tables.

  • How do you know what classes to use ?

    Hello,
    This may sound daft - but how do you know what classes to use to do a particular task ? For example to do password-related stuff - how would I know which classes are all relevant to that ? Am I supposed to buy a book on the classes as the API documentation doesn't really tell you WHEN to use which classes.

    If you're using JSP, then your password field is likely going to be implemented in HTML. So that's nothing to do with Java. (And you can't use a JPassword field in a JSP page.) But when that field comes back to your server, you may be using Java to authenticate it. Even there, the question is not yet what Java method you are going to use, but what methodology. You could have a database to authenticate against, or an LDAP directory. Or you could have the web server use its built-in authentication, which means you don't have to do any Java coding at all. And there are other ways.
    So the question before yours is, how do you know what methodology to use? Again, that comes down to experience.

  • What is a cache monitoring? and what it is used for?

    what is a cache monitoring? and what it is used for? how safe it is to execute the transaction RSRCACHE in development?
    Thank you,
    York

    Hi Les,
    Cache is a temporary storage for recently accessed data.
    Used to enhance query performance.
    Use t-code RSRT to view more on cache.
    Please see this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/41/b987eb1443534ba78a793f4beed9d5/content.htm
    Cache helps to improve query performance. As it can save data in memory, flatfile, cluster table or BLOB.
    You can remove cache per query or inactivate it for perticular info provider or inactivate it overall.
    But which is not recommended. Yes if u know that certain queries you dont use often and its not accessing large number of records then you can inactivate it for those queries. you can manage cache via three t-codes RSRT or RSRCACHE or SPRO>SAP Reference IMG>SAP Busines Wearhouse--> Reporting relevent setting -->General Reporting Setting in BEX -->Global Cache Setting.
    please follow the link which has few good documents on cache. which will clear your complete concept for cache.
    https://service.sap.com/bi -->Product information previous releases -->BI InfoIndex --> OLAP --> you will get bunch of documents in that.
    Look at the following threads :
    OLAP Cache
    what is cache?
    also check RSRT and OLAP cahce docs
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/afc59790-0201-0010-9f99-940f7c3934fc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9f4a452b-0301-0010-8ca6-ef25a095834a
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7c361b95-0501-0010-c0ab-897c5aa14504
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/31b6b490-0201-0010-e4b6-a1523327025e
    Hope this helps.
    ****Assign Points if Helpful****
    Regards,
    Ravikanth.

  • Which BW variable is used for date(range) when creating a portal service

    Hi,
    Can any one please let me know which BW variable is to be used for date(range) when creating a portal service for searching based on dates.
    Thanks
    Abhai

    Hi Arun,
    its just a portal service which would be called when  searching a document created on a particular date or betwwen a range of date.so what i require is which BW variable to be used when handling range.As for variable technical name we use VAR_NAME_I  and for single value variable we VAR_VALUE_EXT_I
    in the similar manner i want BW variable to be used for range of values.
    Thanks
    Abhai

  • Which BW Variable to be used for date when creating service in portal

    Hi,
    Can any one please let me know which BW variable is to be used for date(range) when creating a portal service for searching  based on dates.
    Thanks
    Abhai
    Message was edited by:
            Abhai

    Hi Arun,
    its just a portal service which would be called when  searching a document created on a particular date or betwwen a range of date.so what i require is which BW variable to be used when handling range.As for variable technical name we use VAR_NAME_I  and for single value variable we VAR_VALUE_EXT_I
    in the similar manner i want BW variable to be used for range of values.
    Thanks
    Abhai

  • What can be used for replacing SELECT SINGLE *   ?

    What can be used for replacing SELECT SINGLE *  for improving the performance in the following statements?
    SELECT SINGLE * FROM REGUV
       WHERE LAUFD = G_WLAUFD "RUN DATE ,SY-DATUM
         AND LAUFI = P_LAUFI.  "IDENTICATION NO
    SELECT SINGLE * FROM T100
       INTO CORRESPONDING FIELDS OF G_T100_WA
        WHERE SPRSL = G_T_IALLMESS-MSGSPRA
          AND ARBGB = G_T_IALLMESS-MSGID
          AND MSGNR = G_T_IALLMESS-MSGNR.
    SELECT SINGLE * FROM TBTCO
       INTO CORRESPONDING FIELDS OF TBTCO
        WHERE JOBNAME = FS_JOBNAME.

    If you need all the fields and you know that only one record exists then u need to use select single * only. You can improve the performance by specifying key fields in the where clause of select statements. If the structure of the work area or internal table in which you are fetching the data is same as that of the database table then no need to use corresponding fields clause.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Can a IDOC be used for data exchange from R/3 to CRM

    Hi All,
    First, can a IDOC be used for data exchange from R/3 to CRM
    I need to update few fields of SAP CRM Sales order with fields from SAP R/3 Work Order.
    To achive this can I use IDOC?
    Or do I update the R/3 sales order from R/3 Work order(using some interface or workflow), so that the sales order data flows from R/3 SO to CRM SO.
    Please respond immediately.
    Regards,
    Gopinath

    IDocs can be processed by the CRM system via XML/XIF adaptor. As this will be most probably a new interface that is not yet set up, it would be easier to change the orders in R/3 via an appropiate FM which should automatically generate a delta download BDoc.
    Even if they are not downloaded automatically a request download (defined via R3AR2 / 3 / 4) should take care of this.
    Hope this helps,
    Kai

  • What are the uses for Macbook pro and Macbook air?

    Hi! I am deciding between MBA and MBP and need to know what the different uses for each one was. Like what would you use the MBA for and what would you use the MBP for?? All opinions welcome!!

    They're actually pretty comparible in what they can do if you're talking about the base model of both (say 13") with 4GB RAM. At that level, the Pro has the advantage if you're going to watch or burn DVD's or CD's, as the Air has no optical drive. But otherwise, they're pretty much the same--full-sized, backlit keyboard, camera, beautiful screen, etc. If you're going for more than a basic 13" Pro, then things start to change. For example, you can get up to 8GB RAM on the Pro, and a huge hard drive, you can also get a 15" or 17" size. You will be paying a lot for these, but, obviously, if you're going to be working on, say, making videos (which you may then want burn onto disk) the Pro is very much what you'll want.
    However, if you don't need or want any of that--if, for example, you plan to do the usual programs (word processing, games, web surfing, music, etc.), then you really won't see much difference between the two. At 4GB RAM and a 13" screen, the big difference is going to be thickness and weight, not power. And in this the Air will have the advantage--it's really amazingly slim, light and with a SSD, faster (you pay extra--a lot extra--to get SSD on the Pro).
    Just to make the point, I switched from a 13" Pro to an 11" Air. My hard drive size is half what it was with a Pro, but I was barely taking up half of that amount on the Pro, and so have plenty of room on my 128GB Air (you can get 256GB for the 11" if you order it online). Absolutely everything my Pro did, my Air does (sans optical drive), only faster and lighter and more compact--meaning it takes up less table space, slips in and out of my bag faster, balances on my lap easier, etc. But there was no interruption of service--I switched pretyt seamlessly from 13" Pro to 11" Air.
    The Pro offers you more options for power, screen size, HD size and optical drive. But it's really pretty surprising how few of us need that much power, that much room, or the optical drive. It's very freeing to realize that less can be more than enough.

  • What cable to use for this?

    I am trying to hook up my xbox 360 to my Macbook pro, and I am unsure of what cable to use for this. Composite cables.

    Hi there Dsc, i tried to do so b4, but with limited success, now the problem is like been told you, MBP is not design to accept INPUT video signals, i got something called EYETV coast me about 120$, but the resolution that XBOX accepts is much higher than MBP screen can afford, i got this message when i tried to hook it up ( the dash board came up from the xbox ): YOU NEED TO ADJUST YOUR SCREEN TO A HIGHER ADJUSTMENT BEFORE YOU CAN PLAY GAMES ON THE CONSOL or so, but thats my experience any way, if you succeeded please let me know, by the way i asked the same Q b4, just search my questions and you will see the answers on my question. hope this helped.

  • What can I use for a low battery warning on a Mac Book OSX10.8?

    What can I use for a low battery warning on a Mac Book OSX10.8?

    What you should see above all your windows when your battery gets to low.

  • What font is used for the menu of Illustrator CS5?

    What font is used for the menu of Illustrator CS5?
    I know how to change the default font, which is used to input characters.
    But, I do not know how to check the font used in the menu.
    Is it the font that is described in the following files?
    C:\Users\[UserName]\AppData\Roaming\Adobe\Adobe Illustrator CS5 Settings\ja_JP\AIPrefs
    If you know, please tell me how to check the configuration file and how to change the font that is used in the menu.

    If your using windows xp and applied the 12.02 update, then this is a known bug in
    the update effecting xp users and adobe is working on a fix.
    see this thread
    http://forums.adobe.com/thread/762392?tstart=30
    MTSTUNER

Maybe you are looking for

  • How to compare the no. items in an order i ERP and CRM?

    Hi SAP Experts, We are facing an issue where the number of line  items in an order(same order) in ERP and CRM are different , properly not synchronized.e.g., one order in ERP is having 5 line items but in CRM for the same order has 7 line items. How

  • Payment of duplicate apps

    Does anyone know if you have previously purchased an app for your Iphone or Ipod and you buy the same app for your MacBook will it recognize that you paid for it before like it does on the other devices, or will it charge you?

  • Unable to activate Message Mapping (Until i restart PI )

    Dear all, I am using PI 7.1. I am trying to activate the message mapping objects in ESR. but it is not getting activated. I see the following error message in the process log: Activation of the change list canceled Check result for Message Mapping: M

  • How to concatenate in se38 and smartforms.

    hi experts      i m new in sap, so please help me out from my query regarding concatenate. I have written code in se 38 by concatenating  2 fields and i am getting output . But now when i am using smartforms with se38, i am not getting output. I thin

  • Submit iweb site to search engines

    Hi Everyone, Whats the best way to submit your site to the search engines??