03-07-2013 09:03 PM
I am trying to write a function to create an event on the calendar
//the function takes in the start year, month, day and time. Also the end time
EventList eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT
Event e = eventList.createEvent();
e.addString( Event.SUMMARY, PIMItem.ATTR_NONE, "The Gym");
e.addString( Event.LOCATION, PIMItem.ATTR_NONE, "Gym");
//epoch date january 1, 1970
e.addDate(Event.START, PIMItem.ATTR_NONE, startDate);
e.addDate(Event.END, PIMItem.ATTR_NONE, endDate);
I am stuck trying to figure out how to convert, say, a input 2013(year), 3(month), 7(day) into millisecond so I can
put it in startDate field
Solved! Go to Solution.
03-07-2013 09:16 PM
1) Use a Calednar Object, use the 'set' methods associated with it to set the year, month day etc (not forgetting the January is actually month 0) and then get the Date from that and then the time from the Date.
2) Format your date so that it is acceptable to HttpDateParser, and the run that against your date string.