php - Laravel Multiple Timezones -


i trying build database of user trips, involves storing:

  • flightnumber
  • departureairport
  • departuretime
  • arrivalairport
  • arrivaltime

note, both airports can in different timezones. need work out time difference, , number of days flight etc.

i not sure how approach problem. should add more columns store local date time, , utc times?

also, have seen laravel has datetimetz() column type. doesn't seem storing information 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",    } 

easiest way store date , time in unix timestamp (it's timezone independent). can convert timezone (depends on user location or airport timezone)


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -