E9 858 then UX 9164 at Madrid
San José (Costa Rica) → Madrid → Gran Canaria
Timetable, Madrid time
15:10E9 858 from San José (Costa Rica) at the gate
15:05UX 9164 to Gran Canaria leaves the gate
23 h 55 apart on the timetable, overnight
UX 9164 leaves 23 h 55 after E9 858 arrives on the timetable: more than half a day, so not a connection we count.