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!
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.