php - Change now() function's timezone -


I want to keep my country time in the reg_date area in my DB table. But now () sets the time of the server How can the timing of the now () function change for Azerbaijan (UTC +04.00)?

The timestamp should be returned in the current timezone as set on your system. If you can not change the time zone of the system, you may need to manipulate PHP / Ruby / Time before saving it, or you can save time by using UNIX_TIMESTAMP (). You can choose the option . Using code (PHP) (5.3+) to manipulate the time zone before INSERT ING in the database:

  // .... some predecessor items $ date = new dateTime (); $ Date-> Set timezone (new datetime zone ('Asia / Baku')); $ Fdate = $ date- & gt; Format ('Y-M-DH: I: S'); // Now format the form now () $ query = "TBL (field, built-on) values ​​('bla', '$ fdate')"; Mysqli_query ($ query); // ... and so on    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -