doujiu4643 2014-01-03 23:30
浏览 29
已采纳

如何从数字中获取eBay拍卖结束时间?

I am trying to scrape information from for eBay search result

In source I see

<span class="MINUTES timeMs" timeMs="1388791906000"></span>
<span class="HOURS timeMs" timeMs="1388797706000"></span>

What format is timeMs value? I want to convert it to timestamp, but I don't recognize for what these numbers stands for?

P.S. Don't want to use eBay API!

  • 写回答

1条回答 默认 最新

  • dongyou8087 2014-01-03 23:38
    关注

    timeMs is in Unix EpochTime.

    Once timeMs is stored in $timeMs, then use the following:

    $date_time = new DateTime("@$timeMs");
    $formatted_time = $date_time->format('Y-m-d H:i:s');
    

    Also, as an alternative to using the DateTime class, you can use:

    echo date('r', $timeMs); // output as RFC 2822 date - returns local time
    echo gmdate('r', $timeMs); // returns GMT/UTC time
    

    as explained here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何使用simulink建立一个永磁同步直线电机模型?
  • ¥30 天体光谱图的的绘制并得到星表
  • ¥15 PointNet++的onnx模型只能使用一次
  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗