I'm developing a Laravel 6 website with an international focus across various time zones. User comments are being stored in the MySQL database using the default created_at and updated_at UTC timestamps. I retrieve those timestamps in my blade view, e.g. {{ $comment->created_at }}. (On a side note, I use Datatables to display that information among others, so they get wrapped in td). I would like those timestamps to be displayed to the user in his local time.
Upon doing about two hours of research on ways to accomplish that, I did realize that some people suggest retrieving the IP address of the user upon logon and matching that to a geolocation and hence timezone. They would then save that information in the user table of the database and use some PHP function (or Carbon) to translate that into the user's local date/time. I find that solution a bit cumbersome and probably inaccurate. Other people used some method where they end up with specific CSS DIV styles which will then display the user's local time. However, I'm not sure whether that would go well with my use of Datatables. A third potential solution that I looked at was moment.js and it seems to be the cleanest but I'm not sure how this can get implemented, i.e. I was lacking a practical example (I saw somebody asking about the implementation in Vue, but I'm not that skilled yet).
I would therefore like to ask if somebody could please give me an example by showing some code as to how to implement what I would like to achieve in my Laravel project?
Many thanks in advance to everybody!