Results 1 to 6 of 6
  1. #1
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default Formatting the date

    I would like to ask if anyone knows how to format the date such that it shows Thursday, November 30, 2006.

    I'm currently using this line of code to format my date but i want it to display to the one as above.
    DateFormat fileDateFormat = new SimpleDateFormat("dd/MMM/yyyy");

    is it possible to do that using simple date format?

  2. #2
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    This code:
    Java Code:
    Date now = new Date();		
    SimpleDateFormat sdf = new SimpleDateFormat("EEEEEE, MMMM dd, yyyy" );
    System.out.println(sdf.format(now));
    will out put this:
    Monday, May 07, 2007

  3. #3
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default

    Thanks! It has showed what i wanted it to show but what does the EEEEE means?

  4. #4
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    If you look at the API
    SimpleDateFormat (Java 2 Platform SE v1.4.2)
    you will see that E prints the day of the week, just like yyyy prints the year.

  5. #5
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default

    ohh.. i see.. i understand now. Thanks. I'm really a newbie in Java. :)

  6. #6
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    No problem. I am happy to help.I have a million or more questions about java myself.

Similar Threads

  1. formatting..
    By sireesha in forum New To Java
    Replies: 16
    Last Post: 06-26-2009, 08:11 PM
  2. Formatting a number to currency
    By Java Tip in forum java.text
    Replies: 0
    Last Post: 04-16-2008, 11:59 PM
  3. Difference between current date and anothe date
    By vijay balusamy in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 05:15 PM
  4. formatting String
    By bugger in forum New To Java
    Replies: 1
    Last Post: 11-16-2007, 08:27 PM
  5. Correct Number formatting
    By paul in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:59 AM

Posting Permissions

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