As it's listed on the Available Column Types section here: https://laravel.com/docs/5.2/migrations#creating-columns
We can define a new column with the type 'dateTimeTz'
, however it gives little to no clue how it should look or if it's just like a standard DateTime object. I've been searching all over the places about this type, but couldn't see anything relevant.
Can somebody explain the difference between this one and 'dateTime'
?
The datetimeTz column field is actually imported from Doctrine's datetimetz with additional timezone information.
In general, this helps to work with PHP's Datetime object by setting the timezone information. To learn more about when and when not you should use it, you should read this https://derickrethans.nl/storing-date-time-in-database.html
It looks like this is just an option for database systems that support two different types -- datetime without timezone information and datetime with timezone information.
I'd guess that if you use the dateTimeTz
type with a database that doesn't support it, it would fall back to dateTime
.
Similar question here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With