var data = [{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"1451143100","operationType":1,"vehicleId":"233","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLURYL","destinationName":"Rayners Lane Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1329,"currentLocation":"At Finsbury Park Platform 3","towards":"Rayners Lane","expectedArrival":"2025-08-21T19:31:20Z","timeToLive":"2025-08-21T19:31:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"768443754","operationType":1,"vehicleId":"235","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUHR4","destinationName":"Heathrow Terminal 4 Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1629,"currentLocation":"At Turnpike Lane Platform 2","towards":"Heathrow via T4 Loop","expectedArrival":"2025-08-21T19:36:20Z","timeToLive":"2025-08-21T19:36:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"1315244431","operationType":1,"vehicleId":"236","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":969,"currentLocation":"Between Acton Town and Turnham Green","towards":"Cockfosters","expectedArrival":"2025-08-21T19:25:20Z","timeToLive":"2025-08-21T19:25:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"1315178895","operationType":1,"vehicleId":"246","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1449,"currentLocation":"At Ealing Common Platform 2","towards":"Cockfosters","expectedArrival":"2025-08-21T19:33:20Z","timeToLive":"2025-08-21T19:33:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-526738400","operationType":1,"vehicleId":"257","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":729,"currentLocation":"Between Ravenscourt Park and Hammersmith","towards":"Cockfosters","expectedArrival":"2025-08-21T19:21:20Z","timeToLive":"2025-08-21T19:21:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"2114669666","operationType":1,"vehicleId":"300","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":99,"currentLocation":"Between South Kensington and Knightsbridge","towards":"Cockfosters","expectedArrival":"2025-08-21T19:10:50Z","timeToLive":"2025-08-21T19:10:50Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"903437080","operationType":1,"vehicleId":"312","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUHR4","destinationName":"Heathrow Terminal 4 Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":609,"currentLocation":"Between Russell Square and Holborn","towards":"Heathrow via T4 Loop","expectedArrival":"2025-08-21T19:19:20Z","timeToLive":"2025-08-21T19:19:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"768509291","operationType":1,"vehicleId":"325","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUHR5","destinationName":"Heathrow Terminal 5 Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":729,"currentLocation":"Between King's Cross and Russell Square","towards":"Heathrow T123 + 5","expectedArrival":"2025-08-21T19:21:20Z","timeToLive":"2025-08-21T19:21:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-526541791","operationType":1,"vehicleId":"327","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUUXB","destinationName":"Uxbridge Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":969,"currentLocation":"At Caledonian Road Platform 2","towards":"Uxbridge","expectedArrival":"2025-08-21T19:25:20Z","timeToLive":"2025-08-21T19:25:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"2114473058","operationType":1,"vehicleId":"330","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUHR5","destinationName":"Heathrow Terminal 5 Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1749,"currentLocation":"At Wood Green Platform 2","towards":"Heathrow T123 + 5","expectedArrival":"2025-08-21T19:38:20Z","timeToLive":"2025-08-21T19:38:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1867526009","operationType":1,"vehicleId":"331","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1209,"currentLocation":"Approaching Acton Town Platform 3","towards":"Cockfosters","expectedArrival":"2025-08-21T19:29:20Z","timeToLive":"2025-08-21T19:29:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1867591545","operationType":1,"vehicleId":"341","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1329,"currentLocation":"Between South Ealing and Acton Town","towards":"Cockfosters","expectedArrival":"2025-08-21T19:31:20Z","timeToLive":"2025-08-21T19:31:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"1451012029","operationType":1,"vehicleId":"353","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUASG","destinationName":"Arnos Grove Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1509,"currentLocation":"At South Ealing Platform 1","towards":"Arnos Grove","expectedArrival":"2025-08-21T19:34:20Z","timeToLive":"2025-08-21T19:34:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-2003619114","operationType":1,"vehicleId":"364","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Eastbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUCKS","destinationName":"Cockfosters Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":1509,"currentLocation":"At South Ealing Platform 2","towards":"Cockfosters","expectedArrival":"2025-08-21T19:34:20Z","timeToLive":"2025-08-21T19:34:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"768247147","operationType":1,"vehicleId":"365","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUHR5","destinationName":"Heathrow Terminal 5 Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":429,"currentLocation":"At Leicester Square Platform 1","towards":"Heathrow T123 + 5","expectedArrival":"2025-08-21T19:16:20Z","timeToLive":"2025-08-21T19:16:20Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1867788153","operationType":1,"vehicleId":"371","naptanId":"940GZZLUKNB","stationName":"Knightsbridge Underground Station","lineId":"piccadilly","lineName":"Piccadilly","platformName":"Westbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUHR5","destinationName":"Heathrow Terminal 5 Underground Station","timestamp":"2025-08-21T19:09:11.3078844Z","timeToStation":99,"currentLocation":"At Hyde Park Corner Platform 2","towards":"Heathrow T123 + 5","expectedArrival":"2025-08-21T19:10:50Z","timeToLive":"2025-08-21T19:10:50Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-21T19:09:21.893Z","sent":"2025-08-21T19:09:11Z","received":"0001-01-01T00:00:00"}}] var times = []; for (var i = 0; i < data.length; i++) { var platformName = data[i].platformName.replace(" - Platform ", ' platform '); var platformName = platformName.toLowerCase(); if (data[i].towards.includes('Check Front of Train')) { var towards = ' (check front of train for destination)'; } else { var towards = ' (towards ' + data[i].towards + ')'; } var towards = towards.replace(" (Circle)", ''); var towards = towards.replace("Elephant and Castle", 'Elephant & Castle'); var towards = towards.replace("Harrow and Wealdstone", 'Harrow & Wealdstone'); var towards = towards.replace("T123 + 5", 'Terminals 2-3 & 5'); var towards = towards.replace("via CX", 'via Charing Cross'); var expectedArrival = data[i].expectedArrival.split("T"); var expectedArrival_bits = expectedArrival[1].split(":"); var expectedArrival = expectedArrival_bits[0] + ':' + expectedArrival_bits[1] + towards; var time = data[i].lineName + ' ' + platformName + ' –' + expectedArrival; var time = time.replace("Bakerloo", 'Bakerloo line'); var time = time.replace("Central", 'Central line'); var time = time.replace("Hendon Central line", 'Hendon Central'); var time = time.replace("Finchley Central line", 'Finchley Central'); var time = time.replace("Walthamstow Central line", 'Walthamstow Central'); var time = time.replace("Wembley Central line", 'Wembley Central'); var time = time.replace("Circle", 'Circle line'); var time = time.replace("towards Circle line", 'check front of train for destination'); var time = time.replace("towards Circle Line", 'check front of train for destination'); var time = time.replace("District", 'District line'); var time = time.replace("Docklands Light Railway", 'Docklands Light Railway'); var time = time.replace("DLR", 'Docklands Light Railway'); var time = time.replace("Hammersmith & City", 'Hammersmith & City line'); var time = time.replace("Jubilee", 'Jubilee line'); var time = time.replace("Metropolitan", 'Metropolitan line'); var time = time.replace("Northern", 'Northern line'); var time = time.replace("Piccadilly", 'Piccadilly line'); var time = time.replace("Elizabeth", 'Elizabeth line'); var time = time.replace("Victoria", 'Victoria line'); var time = time.replace("(via Victoria line)", 'via Victoria'); var time = time.replace("Waterloo & City", 'Waterloo & City line'); var time = time.replace("via Bank", 'via Bank loop'); var time = time.replace("via Charing Cross", 'via Charing Cross loop'); var time = time.replace("northbound platform", 'Northbound platform'); var time = time.replace("southbound platform", 'Southbound platform'); var time = time.replace("eastbound platform", 'Eastbound platform'); var time = time.replace("westbound platform", 'Westbound platform'); var time = time.replace("inner rail", 'Inner rail'); var time = time.replace("outer rail", 'Outer rail'); var time = time.replace("23:", '00:'); var time = time.replace("22:", '23:'); var time = time.replace("21:", '22:'); var time = time.replace("20:", '21:'); var time = time.replace("19:", '20:'); var time = time.replace("18:", '19:'); var time = time.replace("17:", '18:'); var time = time.replace("16:", '17:'); var time = time.replace("15:", '16:'); var time = time.replace("14:", '15:'); var time = time.replace("13:", '14:'); var time = time.replace("12:", '13:'); var time = time.replace("11:", '12:'); var time = time.replace("10:", '11:'); var time = time.replace("09:", '10:'); var time = time.replace("08:", '09:'); var time = time.replace("07:", '08:'); var time = time.replace("06:", '07:'); var time = time.replace("05:", '06:'); var time = time.replace("04:", '05:'); var time = time.replace("03:", '04:'); var time = time.replace("02:", '03:'); var time = time.replace("01:", '02:'); var time = time.replace("00:", '01:'); times.push(time); } times.sort(); var real_times = []; var done_platforms = []; for (var i = 0; i < times.length; i++) { var pieces = times[i].split(" –"); if (done_platforms.indexOf(pieces[0]) != -1) { var piece = ' ' + pieces[1]; } else { var piece = '

' + pieces[0] + ' ' + pieces[1]; } real_times.push(piece); done_platforms.push(pieces[0]); } var real_times_array = real_times.toString(); var real_times_array = real_times_array.replace(/\,

/g, '

'); var real_times_array = real_times_array.replace(/\,/g, ' · '); var real_times_array = real_times_array.replace(/\(towards \)/g, '(check front of train for destination)'); if (real_times_array.length < 25) { var real_times_array = real_times_array + '

Timetable information is not available

'; } var real_times_array = real_times_array + '

'; var real_times_array = real_times_array + '

Powered by TfL Open Data. Contains OS data © Crown copyright and database rights 2016 / Geomni UK Map data © and database rights 2019

'; document.getElementById("departures").innerHTML = real_times_array;