views:

24

answers:

1

Java fb API I am creating facebook web application, to create even following is the required params.

http://developers.facebook.com/docs/reference/rest/events.create

Problem is with start_time and end_time .

Just assume i am have to Date objects without timezone.

Date startDate = new Date();
Date endDate = new Date();

can anybody guide me how to convert this require fb format.

A: 

Note: The start_time and end_time are the times that were input by the event creator, converted to UTC after assuming that they were in Pacific time (Daylight Savings or Standard, depending on the date of the event), then converted into Unix epoch time.

I believe you need to convert to seconds from milliseconds.

startDate = (int) (System.currentTimeMillis() / 1000L);
endDate = startDate + (1*60*60*24);

Where

(1*60*60*24) = 1 day, replace with the length of your event.

From the results, the offset (if required) can be worked out and added into the startDate creation.

Gazler
above code not working too in facebook, even if i crate event from facebook interface and come back to view the event it is showing different timing itself, seems they are having a bug.
Faisal khan