Reputation: 33
I'm learning about APIs with Last.fm API. How can I know what dates are the ones specified in this example code (chart from="1108296002")?
<weeklychartlist tag="rock">
<chart from="1108296002" to="1108900802"/>
<chart from="1108900801" to="1109505601"/>
...
</weeklychartlist>
I got the example here: http://www.last.fm/api/show/tag.getWeeklyChartList
Upvotes: 3
Views: 616
Reputation: 106443
It's Unix timestamps actually. Depending on the language/platform you use, it should be quite simple or right away trivial to convert them into real dates. That's how it can be done in JavaScript, for example:
var from = new Date(1000 * 1108296002);
var to = new Date(1000 * 1108900802);
console.log(from.toUTCString());
// Sun, 13 Feb 2005 12:00:02 GMT
console.log(to.toUTCString());
// Sun, 20 Feb 2005 12:00:02 GMT
It's timestamp * 1000, because in JavaScript '... date objects are based on a time value that is the number of milliseconds since 1 January, 1970 UTC'.
Upvotes: 1