Answer the question
In order to leave comments, you need to log in
How to get the date and time of the user in PHP in Yii2 without using JavaScript?
In Yii2 I use Kartik's DateTimePicker widget, pass the user's date and time:
As I understand it, I get server time that is 1 hour behind my time... How can I get the current time and date of the user's computer without using JavaScript? Help with code please.'options'=>['value' => date("d.m.Y H:i:s")]
Answer the question
In order to leave comments, you need to log in
On the server, it's better to work with a single server time zone (preferably UTC), and do all the formatting and time conversion to the desired time zone on the client. For these purposes, I usually start a constant somewhere in the global scope of the JS script, which stores the offset of the user's time zone relative to UTC, and this constant is used wherever the date / time is displayed.
Good morning.
Set the time zone in the configuration file and everything will be fine.
How to work with date and time in js.
How to get the current time and date of the user's computer without using JavaScript?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question