doutu2017 2016-10-08 10:26 采纳率: 0%
浏览 95
已采纳

使用php为ebay创建日期时间

I cannot create a valid datetime with php for ebay finding api.

According to their api, the datetime value should look like this

2004-08-04T19:09:02.768Z

I found in the php documentation that there is a special notation for ISO 8601 with (new DateTime())->format('c') but it does not give me the correct date.

Anyone know how to create one?

  • 写回答

1条回答 默认 最新

  • dtrhd2850 2016-10-08 10:36
    关注

    Try This:

    <?php
        $time = microtime(true);
        $tMicro = sprintf("%03d",($time - floor($time)) * 1000);
        $tUtc = gmdate('Y-m-d\TH:i:s.', $time).$tMicro.'Z';
        echo $tUtc;
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?