search

Home  >  Q&A  >  body text

php timestamp conversion

Now that we have obtained two different timestamps from the system, is there any way to convert this difference into seconds plus milliseconds? ?

PHP中文网PHP中文网2812 days ago414

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 13:11:51

    function getMillisecond() {
    list($t1, $t2) = explode(' ', microtime());
    return (float)sprintf('%.0f',(floatval($t1)+floatval($t2))*1000);
    }
    echo getMillisecond();

    Find a function online and give it a try

    reply
    0
  • 怪我咯

    怪我咯2017-05-16 13:11:51

    PHP’s timestamp can only go to the second level. If you add milliseconds, add 000 at the end

    reply
    0
  • Cancelreply