Results 1 to 2 of 2
  1. #1
    liam_page1 is offline Member
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Question can anyone help me with this?

    hi i was wondering if anyone could help me out with the answer to this??!? thanks people

    There is a standard class called DateFormat which (among other things) lets you convert dates to various different output formats. It has a subclass SimpleDateFormat which you may also use).

    Use it to write a method called convert which returns a String in the form dd-mmm-yyyy: when passed a GregorianCalendar with a specific date
    public String convert (Calendar gc) {
    ...
    }

    For example, when myGC is a GregorianCalendar variable representing the 25th of December 2006,
    String s = convert(myGC);
    should set s to the string "25-Dec-2006".

    Enter your answer (just your convert method) below:

  2. #2
    JAdmin is offline Member
    Join Date
    Jan 2008
    Posts
    20
    Rep Power
    0

    Default

    Use format dd-MMM-yyyy.

    For example, the below code will print current date like 11-Feb-2008

    new SimpleDateFormat("dd-MMM-yyyy").format(new Date()));
    Sincerely, Your friends at www.javaadvice.com

Posting Permissions

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