Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
81
rated 0 times [  83] [ 2]  / answers: 1 / hits: 78618  / 9 Years ago, tue, august 25, 2015, 12:00:00

I'm using the Hacker News API made at Algolia here:


https://hn.algolia.com/api


I'm a bit confused as it says to search for posts since a certain time it says to run the following query:


Comments since timestamp X (in second)
http://hn.algolia.com/api/v1/search_by_date?tags=comment&numericFilters=created_at_i>X


It says to replace X with a timestamp in seconds, but how exactly would you do this? Let's say the last post I have is at 2015-08-25T15:35:58.000Z. How exactly would I run this query to search for posts since that date? I don't know how to convert this date to seconds...


More From » date

 Answers
8

getTime() will get the date in milliseconds, so divide by 1000:



var date = new Date(2015-08-25T15:35:58.000Z);
var seconds = date.getTime() / 1000; //1440516958

[#65302] Friday, August 21, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jazminkyrap

Total Points: 631
Total Questions: 89
Total Answers: 109

Location: Finland
Member since Fri, Oct 21, 2022
2 Years ago
;