Home » Categories » MySQL » Configuration

MySQL-PHP get and echo NOW() value?

mysqld
default-time-zone='timezone'
SETGLOBAL time_zone =timezone;

<?php
$query = "SELECT NOW() as `now`";
$result = $mysqli->query($query);
$row = $result->fetch_array();
$now = $row['now'];
echo "$now\n";
?>

Reference:
https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html
https://stackoverflow.com/questions/16094232/mysql-php-get-and-echo-now-value

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments (1) Attachments
Comments Comments
There are no comments for this article. Be the first to post a comment.
Related Articles RSS Feed
How to change the MySQL root account password on CentOS7?
Viewed 617 times since Sat, Sep 5, 2020
How do I disable Strict Mode in MySQL?
Viewed 726 times since Mon, Sep 28, 2020
How can I disable MySQL Strict Mode?
Viewed 836 times since Mon, Sep 28, 2020
Your Password does not satisfy the Current Policy Requirements
Viewed 653 times since Sat, Sep 19, 2020