I am working on an application with train schedules, where the first train leaves at 0400 while the last train leaves at 0200. The users of this application therefore deal with days starting at 0300 and ending at 0300. In other words, when they say "The Wednesday-train at 0200" they really mean "The train that leaves on Thursday at 0200".
Our application needs to store all of the trains leaving on (for example) Wednesday, which means it should not include the trains that leave before 0300 but it should include the trains that leave the next day until 0300.
How would I represent this in application without going mad? And how should this be stored in a database for easy querying?