
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How do I set the timezone of MySQL?
To know the current time, we can use the now() function with SELECT statement. The query is as follows −
mysql> SELECT now();
After executing the above query, we will get the current time. The following is the output −
+---------------------+ | now() | +---------------------+ | 2018-10-06 12:57:25 | +---------------------+ 1 row in set (0.02 sec)
To set the time zone, we can use the command SET. The syntax is as follows −
mysql> SET time_zone = "Some value";
Now I am applying the above query to set the time zone. The query is as follows −
mysql> SET time_zone = "+9:50"; Query OK, 0 rows affected (0.00 sec)
We can set globally as well with the help of SET command −
mysql> set global time_zone="+9:00"; Query OK, 0 rows affected (0.00 sec)
- Related Articles
- How do I print a Python datetime in the local timezone?
- How to change MySQL timezone?
- How do I find out the default server character set in MySQL?
- How do I set the default value for a column in MySQL?
- How do I see what character set a MySQL database / table / column is?
- How do I set the size of a list in Java?
- How do I set the Selenium webdriver get timeout?
- How do I get the current time zone of MySQL?
- How do I use the @ sign in MySQL?
- How do I INSERT INTO from one MySQL table into another table and set the value of one column?
- How can I view the indexes I have set up in MySQL?
- How do I get the creation date of a MySQL table?
- How do I clone the structure of a table in MySQL?
- How do I lag columns in MySQL?
- How do I remove a MySQL database?

Advertisements