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.

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

报告相同问题?

悬赏问题

  • ¥100 寻找:光电二极管电路设计服务
  • ¥15 YOLOv5改进后的结构图
  • ¥15 全志v3s怎么设置高速时钟,使用的荔枝派zero开发板,串口2需要921600的波特率
  • ¥15 关于#单片机#的问题:Lora通讯模块hc-14电路图求内部原理图
  • ¥50 esp32 wroom 32e 芯片解锁
  • ¥15 bywave配置文件写入失败
  • ¥20 基于Simulink的ZPW2000轨道电路仿真
  • ¥15 pycharm找不到在环境装好的opencv-python
  • ¥15 在不同的执行界面调用同一个页面
  • ¥20 基于51单片机的数字频率计