posted 22 years ago
Dear Wai Meng,
Of course it is possible to format dates into whatever format you want. The easiest way to do this is by using the java.text.SimpleDateFormat class. It gives you the possibility to set the format when creating an instance of the class, while the format(Date d) function returns a String with the date according to the set format.
I wasn't sure if in your case you had an object of type Date or of type String, with the date from the Oracle database. If you have a Date object called dDate, then this is about all you need to do to print the date in your preferred format:
If you have a String with the date in it, say sDate, you'll have to parse it to a Date first, before you can do the above. The parsing can be done with the java.text.SimpleDateFormat too. Though in this case you'll need a second formatter, this time with the format of the Oracle date:
Hope this helps,
Tim