FlightAware Discussions

FlightInfoEx returning epoch time 24 hours later

Hi. I am new to this so forgive me if I have made a simple mistake.

I am using FlightInfoEx to return the epoch time for filed_departure time. If I run the script for flight VA837 (Schedule departure is 11am) at 10am, the epoch time returned is for 11am the next day. So 25 hours later. I would expect it to return the epoch time for the next flight which is only 1 hour later.

var fxml_url = 'http://*user:key*@flightxml.flightaware.com/json/FlightXML2/'; $(document).ready(function() { $('#go_button').on('click', (function() { $.ajax({ type: 'GET', url: fxml_url + 'FlightInfoEx', data: { 'ident': $('#flightid').val(), 'howMany': 1, 'offset': 0 }, success : function(result) { I am running this from the Australia/Melbourne time zone, but didn't think the time zone would affect the epoch time returned. Thanks

FlightInfoEx returns multiple flights for any given ident, including some in the past and some in the future. You should not request howMany=1 and expect it to necessarily be the flight that you are interested in, since the first flight returned will always be the furthest flight in the future that we tentatively know about. Your application should be designed to request multiple and look through the multiple flights returned by FlightInfoEx and find the flight on the specific day and to the specific origin/destination that your user is interested in.

All good I think. I set the offset to 1 not 0. In reading more it returns all posted flights with the latest available being the flight 24 hours later. So need to return offset of 1 to get the next flight. Not sure if this is consistent for all flights. Is there a way to determine only the next flight?


Ok great. Will work on that type of script. Sorry, I replied before I saw your message.

Appreciate the quick response. Cheers