Date

How to get time of all timezones in PHP
How to get time of all timezones in PHP

To get an array of all time zones with their time offset from Greenwich, use the following function:

function get_time_timezones()
{
	$zones_array = array();
	$timestamp = time();
	
	$default_timezone = date_default_timezone_get();
	$timezone_list = timezone_identifiers_list();
	
	foreach ($timezone_list as $zone)
	{
		date_default_timezone_set($zone);
		$zones_array[$zone] = date('P', $timestamp);
	}
	
	date_default_timezone_set($default_timezone);
	
	return $zones_array;
}

read more...

How to find out tomorrow's or yesterday's date in timestamp format in PHP?
How to find out tomorrow's or yesterday's date in timestamp format in PHP?

To get yesterday’s or tomorrow’s date in timestamp format (PHP), you need to use the standard PHP function "strtotime".

For example, let’s display the time of the current date at 00:00:00 (zero hours, zero minutes, zero seconds):

$t = strtotime('00:00:00');
echo 'Timestamp: '.$t;
echo 'Datetime: '.date('Y-m-d H:i:s',$t);

read more...