Guest User

Untitled

a guest
Feb 21st, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. mysql> select now();
  2. +---------------------+
  3. | now() |
  4. +---------------------+
  5. | 2009-05-30 16:54:29 |
  6. +---------------------+
  7. 1 row in set (0.00 sec)
  8.  
  9. mysql> select now();
  10. +---------------------+
  11. | now() |
  12. +---------------------+
  13. | 2009-05-30 20:01:43 |
  14. +---------------------+
  15. 1 row in set (0.00 sec)
  16.  
  17. default-time-zone='+00:00'
  18.  
  19. SELECT @@global.time_zone;
  20.  
  21. SET GLOBAL time_zone = '+8:00';
  22. SET GLOBAL time_zone = 'Europe/Helsinki';
  23. SET @@global.time_zone = '+00:00';
  24.  
  25. SELECT @@session.time_zone;
  26.  
  27. SET time_zone = 'Europe/Helsinki';
  28. SET time_zone = "+00:00";
  29. SET @@session.time_zone = "+00:00";
  30.  
  31. SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP);
  32.  
  33. SELECT UNIX_TIMESTAMP();
  34. SELECT UNIX_TIMESTAMP(NOW());
  35.  
  36. SELECT UNIX_TIMESTAMP(`timestamp`) FROM `table_name`
  37.  
  38. SELECT UNIX_TIMESTAMP(CONVERT_TZ(`utc_datetime`, '+00:00', @@session.time_zone)) FROM `table_name`
  39.  
  40. SET time_zone = timezonename;
  41.  
  42. $ sudo dpkg-reconfigure tzdata`
  43.  
  44. `/etc/init.d/mysql restart`
  45.  
  46. SET GLOBAL time_zone = '+8:00';
  47.  
  48. value="jdbc:mysql://localhost:3306/dbname?serverTimezone=UTC"
  49.  
  50. SELECT @@global.time_zone, @@session.time_zone;
  51.  
  52. SET GLOBAL time_zone = "Asia/Calcutta";
  53. SET time_zone = "+05:30";
  54. SET @@session.time_zone = "+05:30";
  55.  
  56. root@Ubuntu# ls -la /usr/share/zoneinfo/US
  57. total 8
  58.  
  59. drwxr-xr-x 2 root root 4096 Apr 10 2013 .
  60. drwxr-xr-x 22 root root 4096 Apr 10 2013 ..
  61. lrwxrwxrwx 1 root root 18 Jul 8 22:33 Alaska -> ../SystemV/YST9YDT
  62. lrwxrwxrwx 1 root root 21 Jul 8 22:33 Aleutian -> ../posix/America/Adak
  63. lrwxrwxrwx 1 root root 15 Jul 8 22:33 Arizona -> ../SystemV/MST7
  64. lrwxrwxrwx 1 root root 18 Jul 8 22:33 Central -> ../SystemV/CST6CDT
  65. lrwxrwxrwx 1 root root 18 Jul 8 22:33 Eastern -> ../SystemV/EST5EDT
  66. lrwxrwxrwx 1 root root 37 Jul 8 22:33 East-Indiana -> ../posix/America/Indiana/Indianapolis
  67. lrwxrwxrwx 1 root root 19 Jul 8 22:33 Hawaii -> ../Pacific/Honolulu
  68. lrwxrwxrwx 1 root root 24 Jul 8 22:33 Indiana-Starke -> ../posix/America/Knox_IN
  69. lrwxrwxrwx 1 root root 24 Jul 8 22:33 Michigan -> ../posix/America/Detroit
  70. lrwxrwxrwx 1 root root 18 Jul 8 22:33 Mountain -> ../SystemV/MST7MDT
  71. lrwxrwxrwx 1 root root 18 Jul 8 22:33 Pacific -> ../SystemV/PST8PDT
  72. lrwxrwxrwx 1 root root 18 Jul 8 22:33 Pacific-New -> ../SystemV/PST8PDT
  73. lrwxrwxrwx 1 root root 20 Jul 8 22:33 Samoa -> ../Pacific/Pago_Pago
  74. root@Ubuntu#
  75.  
  76. SET time_zone='US/Eastern';
  77.  
  78. SET time_zone='EST5EDT';
  79.  
  80. mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
  81.  
  82. $offset="+10:00";
  83. $db->exec("SET time_zone='".$offset."';");
  84.  
  85. $db->MySQLi->query("SET time_zone='".$offset."';");
Add Comment
Please, Sign In to add comment