[wd_asp elements=’search’ ratio=’100%’ id=1]

Time Formats – Timezone

28th May 2014

Php - Dates & Time

php codehaven

For the MySQL DATETIME format, save as DateTime and use no length in the structure.

date_default_timezone_set('Europe/London');
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
$today = date("m.d.y"); // 03.10.01
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day.
$today = date("H:i:s"); // 17:16:18
$today = date("Y-m-d H:i:s"); // 2001-03-10 17:16:18 (the MySQL DATETIME format)

Find out what timezone is default


echo $mydata = ini_get('date.timezone');