I am trying build a database of user trips, which involves storing:
- FlightNumber
- DepartureAirport
- DepartureTime
- ArrivalAirport
- ArrivalTime
Note, that both the airports can be in different timezones. I need to work out the time difference, and number of days to this flight etc.
I am not sure how to approach this problem. Should I add more columns to store local date time, and UTC times?
Also, I have seen that Laravel has dateTimeTz()
column type. However it doesn't seem to be storing any information about timezone?
Posts Table:
$table->dateTimeTz('newTime')->nullable();
Setting new time:
$p->newTime = \Carbon\Carbon::now('Asia/Kolkata')
=> Carbon\Carbon {#841
+"date": "2017-03-28 16:23:33.490926",
+"timezone_type": 3,
+"timezone": "Asia/Kolkata",
}
>>> $p
=> App\Post {#836
id: 1,
user_id: 1,
title: "Et quaerat deserunt qui ullam voluptas.",
body: "Aut eos id ut qui laborum. Tempore rerum ut quas deserunt voluptas optio.",
slug: "et-quaerat-deserunt-qui-ullam-voluptas",
newTime: "2017-03-28 16:23:33",
created_at: "2017-03-28 10:51:36",
updated_at: "2017-03-28 10:51:36",
}