tags:

views:

61

answers:

2

i receive a timestamp from a soap service in miliseconds.. so i do

Date date = new Date(mar.getEventDate());

how can i extract the day of the month from date, since getDay() and so are deprecated? im using a small hack, but i dont think this is the proper way..

SimpleDateFormat sdf = new SimpleDateFormat("dd");
int day = Integer.parseInt(sdf.format(date));
+7  A: 

Use Calendar for this:

Calendar cal = Calendar.getInstance();
cal.setTime(mar.getEventDAte());
int day = cal.get(Calendar.DAY_OF_MONTH);
cletus
A: 

Use Calendar class.

sza