Results 1 to 2 of 2
Thread: can anyone help me with this?
- 02-11-2008, 01:42 PM #1
Member
- Join Date
- Feb 2008
- Posts
- 2
- Rep Power
- 0
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:
- 02-12-2008, 06:07 AM #2
Member
- Join Date
- Jan 2008
- Posts
- 20
- Rep Power
- 0
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


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks