Showing posts with label time zone. Show all posts
Showing posts with label time zone. Show all posts

Monday, January 20, 2014

Timezone in PHP

By default PHP get the timezone from the "php.ini" file.

Get Current Timezone:
echo date_default_timezone_get(); // Will return current timezone used by PHP.

Set Timezone:
date_default_timezone_set('Asia/Kolkata'); // Will set PHP timezone to specified.

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'.

Learn JavaScript - String and its methods - 16

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