Results 1 to 5 of 5
  1. #1
    javapink is offline Member
    Join Date
    Feb 2011
    Posts
    11
    Rep Power
    0

    Exclamation using dates in java

    hi there,
    i require to ask the user to enter the date in the format dd/mm/yyyy.
    then the program should add 3 days with date provided by the user, and the result is output in the screen. I researched a bit, and i discovered something about a DATE CLASS .. however i tried to avoid using it.. and went to finding another alternative.. i tried to use simple data types...and used intgers as dd , mm and yyyy... however when having day 31 it does not make sense to add 3 to 31 having day 34 lool ... anyway... i need some help to sort this problem out... one thing is.. that i'm using this in a method.. so please guide me on what to insert the method header... not a problem to use the date class... i tried to avoid it just because i thought it was complicated... please keep things simple i;m a very beginner thanks so much!!! appreciate any help!

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    Try class 'GregorianCalendar'.

  3. #3
    javapink is offline Member
    Join Date
    Feb 2011
    Posts
    11
    Rep Power
    0

    Default thnks

    i will try so tomorrow with the gregoriancalendar class...thanks so much for your reply! goodnight!

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default

    You should also look at the SimpleDateFormat class which allows you to convert from a Date to a String and back again.

  5. #5
    jomypgeorge is offline Member
    Join Date
    May 2010
    Posts
    90
    Rep Power
    0

Similar Threads

  1. Dates sometimes off by a day?
    By saggio in forum Advanced Java
    Replies: 13
    Last Post: 12-08-2010, 04:56 PM
  2. UTC Dates
    By PedroCosta in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2010, 06:08 PM
  3. Help with dates
    By bumblyb33 in forum New To Java
    Replies: 1
    Last Post: 02-13-2009, 02:54 PM
  4. How to Compare two Dates
    By Java Tip in forum java.util
    Replies: 1
    Last Post: 06-24-2008, 07:05 AM
  5. differences between 2 dates
    By cecily in forum New To Java
    Replies: 1
    Last Post: 08-02-2007, 05:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •