Skip to main content

Posts

Showing posts with the label datetime

Get Specific Zone Time

Get Specific Zone DateTime from server time function getdateTimeByZone($serverZone , $userZone = 'UTC', $serverDateTime){     //$serverDateTime must be with time     $serverDateTime = date('Y-m-d H:i:s',strtotime($serverDateTime));     $schedule_date = new DateTime($serverDateTime, new DateTimeZone($serverZone));     $schedule_date->setTimeZone(new DateTimeZone($userZone));     $convertedTime =  $schedule_date->format('Y-m-d H:i:s');     return $convertedTime; } echo getdateTimeByZone('America/Los_Angeles' , 'Asia/Karachi', '2015/08/20 04:27 AM');