Monday, January 20, 2014

Timezone in MySQL

By default mysql uses system timezone. That is the server computer's timezone.

Get current timezone:
mysql> select @@global.time_zone; // Will return over all mysql timezone.That is in mysql every user can had separate timezone. This return common timezone.
mysql> select @@session.time_zone;  // Will return current user's timezone.

Set timezone:
mysql> set GLOBAL time_zone = timezone; // Will set timezone for overall mysql.
mysql> set time_zone = timezone; // Will set timezone for current user.

Example timezone format: 'Europe/London', 'Asia/Kolkata'.

No comments:

Post a Comment

Learn JavaScript - String and its methods - 16

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>String and it's methods - JS&l...