how do I calculate arrival and departure time

I’ve been quering the api for flight WJA191 and it is returning an arrival time of the 18th, based on the most recent moment.js db and also verified against epochconverter.com/

The arrival time is incorrect by almost 2 days. Stating it arrives on the 18th, whereas, the actual flight arrives on the 16th.

Additional details: stackoverflow.com/questions/2244 … c-timezone

There is no single “actual flight”, since a given flight number is reused every day (or sometimes multiple times per day) by an airline. You must find the specific instance of the flight for the correct day and correct origin/destination to be sure it is the one you are interested in.

FlightInfoEx returns multiple flights, in chronological time, starting with flights usually a couple days into the future and progressing to flights in the past. The first flight in the returned array is not necessarily the flight you want.

Thanks for the fast reply.

I’m calling FlightInfoEx
I’ve changed my flight number to WS455 and am using the value found in estimatedarrivaltime and get Mar 19 2014 10:46 PM

Is there a simple method or way to find out what flight is the closest to NOW?

I recommend that your application show the available flights, highlight the best one, but still let the user pick which one she is interested in. The “best one” can be any that is currently enroute (actualdeparturetime != 0 and actualarrivaltime == 0), otherwise the next one that is scheduled (actualdeparturetime == 0, filed_departuretime > now, ordered by filed_departuretime ascending).