How to interpret "time" in google places reviews array

1.9k views Asked by At

When retrieving place details in the Google Places API, the array for reviews includes objects representing each review. In these objects, there is a key called "time". I assume this is a value representing some date/time when the review was written, but I don't know how to interpret this value, and I can't find any documentation on that value.

Here is an example review object:

"author_name": "Erin Hardie",
"author_url": "https://plus.google.com/112006772111566435910",
"language": "en",
"rating": 5,
"text": "Our daughter has loved her time at...(truncated for display)",
"time": 1374519902

I use moment.js to handle all my time/date displays, but I dont even know what this number represents. Help!

2

There are 2 answers

0
davecoffin On

With some in depth googling, I finally found an answer to this. The "time" is a unix timestamp. You can deal with it in php with something like this:

$dt = new DateTime("@1433970071");
echo $dt->format('F jS, Y');

Or, you can deal with it using moment.js in javascript by multiplying the timestamp by 1000, as javascript expects milliseconds. Here's where I found my answer in their code:

http://gurutechnolabs.tumblr.com/post/112214772991/how-to-embed-google-reviews-using-google-places

And heres how I found how to convert Unix timestamps to something javascript understands:

using a php unix timestamp with moment.js

0
GoogleTeam On

It is not possible to check the correct date from the app. It is postponed for the data output. And the data shown is estimated and delayed. Initially it shows accurately but after 24 hours the displayed value is less accurate. With months and years the inaccuracy increases.