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 1 of 1

Thread: How to use SDF to display a future date.

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to use SDF to display a future date.

    When I run this the first date displays correctly (without the time of day),
    but I can't figure out how to call the + 14 days date using SDF.
    I just left a ? in place to show where my problem is.
    Corrected:
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat ord = new SimpleDateFormat(“MMM dd, yyyy”):
    cal.add(Calendar.DATE, +14);
    SimpleDateFormat arr = newSimpleDateFormat(“MMM dd, yyyy”):
    System.out.println(“Date of Order: “ + ord.format(cal.getTime));
    System.out.println("ArrivalDate: " + arr.format(cal.getTime) );
    Last edited by amarettoCoffee; January 23rd, 2011 at 06:42 PM. Reason: I was able to solve my problem


Similar Threads

  1. Class to run in future!
    By 256mxr in forum Java Theory & Questions
    Replies: 4
    Last Post: May 21st, 2010, 12:56 AM
  2. Display file name
    By Puk284 in forum Java Servlet
    Replies: 1
    Last Post: April 13th, 2010, 03:13 AM
  3. Future of Java
    By Skynet.Boy in forum Java Theory & Questions
    Replies: 4
    Last Post: March 15th, 2010, 09:12 AM
  4. display time
    By kalees in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: January 1st, 2010, 07:40 AM
  5. Replies: 5
    Last Post: October 15th, 2009, 08:54 PM

Tags for this Thread