Java fb API 我正在创建 facebook Web 应用程序,要创建甚至以下是必需的参数。
http://developers.facebook.com/docs/reference/rest/events.create
问题出在 start_time 和 end_time 。
假设我必须在没有时区的情况下日期对象。
Date startDate = new Date();
Date endDate = new Date();
谁能指导我如何转换这个需要fb格式。
最佳答案
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.
我相信您需要将毫秒转换为秒。
startDate = (int) (System.currentTimeMillis() / 1000L);
endDate = startDate + (1*60*60*24);
哪里
(1*60*60*24) = 1 day, replace with the length of your event.
根据结果,可以计算出偏移量(如果需要)并将其添加到 startDate 创建中。
关于java facebook webapp 创建事件日期时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3878878/