04-10-2010 09:09 PM
hi
How can I convert a string (eg 2010-7-10) to a full day (Monday 10 July 2010) with predefined functions??
04-10-2010 10:08 PM
You could parse the values and pass them to a Date/Calendar object then use the SimpleDateFormat class to print the values back in that form.
04-11-2010 02:05 AM
Try
long date = net.rim.device.api.io.http.HttpDateParser.parse("2 010-7-10");
it should work. You can then use
net.rim.device.api.i18n.DateFormat
to get it in desired format (also localized, if you want).
04-15-2010 06:12 AM
04-15-2010 03:27 PM
This works, I checked:
public static void main(String[] args)
{
long date = net.rim.device.api.io.http.HttpDateParser.parse("2 010-07-10");
DateFormat d = DateFormat.getInstance(DateFormat.DATE_LONG);
System.out.println(d.format(new Date(date)));
}
it prints: Sat, 10 Jul 2010
Your problem is, the month (and probably day) is single digit, not double digit (e.g. 2010-7-1)
If is up to you what to do with it... Either write completely your own parser, or make them two digits using indexof and charat function.
04-15-2010 04:29 PM
If you use the SimpleDateFormat class and a Calendar/Date object, you can format the date any way you want. Look at the class in the JDE docs, it's very flexible and easy to use.