duanjieyi6582 2013-07-26 06:02
浏览 324

如何在javascript中创建18位数的时间戳?

How to create 18 digit timestamp in javascript?

Trying to send http headers to Facebook registration connect plugin which requires an 18 digit timestamp like: 265816695112975178

It is supposed to be current date-time reference.

Can anyone please help me build the code in Javascript preferably to create the timestamp? If not in JS then PHP please.

Thanks

  • 写回答

1条回答 默认 最新

  • dory4404 2013-07-26 06:06
    关注

    Normally a timestamp of that magnitude indicates the number of milliseconds since the unix epoch (January 1st 1970, midnight UTC). EDIT: This doesn't actually give 18 digits... it gives 13 digits for "modern" timestamps.

    Getting that in Javascript is easy, as that's the natural representation inside a Date object:

    var timestamp = new Date().getTime();
    

    The current value is about 1374818815000.

    If that's not the intended semantics, you'll have to give more details (or link to documentation).

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?