java facebook webapp 创建事件日期时区

标签 java events facebook date

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/

相关文章:

java - 只有当物体进入范围时才触发接近检测器,而不是当他在范围内移动时

java - java中的@Override注解如何检查方法的拼写错误?

javascript - onclick 事件冒泡顺序

javascript - 具有优先级的事件发射器库?

php - 将图片上传到页面相册可以,但将图片发布到墙上不行

java - 无法实例化 HttpClient 类型

java - 使用 Jenkins 通过 SSH 发送文件或执行命令时脚本不退出

Java:如何实现独立于java组件的isKeyDown()功能?

java - 提取json信息

android - Facebook AccessToken.getAccessToken 在应用程序打开时为空,即使在首次登录后也是如此