Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Increment a date

  1. #1
    Member
    Join Date
    Feb 2011
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Increment a date

    My program takes in a date in the format (mm/dd/yyyy) and I want to create a method which increments that date by any number (given to us by the user). What would be the best way of doing this, assuming I can't use the calender class?

    Right now I have a method which counts the number of days from the first day of the Gregorian calender, 10/15/1582, to the date that was given. What can I do with this number to get the desired result?


    Any help is appreciated

    Thanks
    Last edited by colerelm; September 29th, 2011 at 11:59 PM. Reason: Nevermind I got it.


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Increment a date

    Part your date into three parts. 1. day 2. month. 3. year
    When you get a number, add it into day first.
    And then keep on doing the mathematic part. Just think for a while and you will know the answer.

Similar Threads

  1. Replies: 1
    Last Post: July 22nd, 2011, 07:08 AM
  2. same date should entered in another date field
    By shashib09 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: July 14th, 2011, 08:42 AM
  3. [SOLVED] Increment Statements Difference
    By chronoz13 in forum Java Theory & Questions
    Replies: 4
    Last Post: May 10th, 2011, 01:51 PM
  4. [SOLVED] Help with prefix and postfix(increment&decrement)
    By Lokesh in forum Object Oriented Programming
    Replies: 1
    Last Post: February 12th, 2011, 10:20 AM
  5. auto-increment of primary key
    By hundu in forum Enterprise JavaBeans
    Replies: 1
    Last Post: May 15th, 2010, 10:55 AM