I am trying to set the Start Date & Time automatically to the users current date and time when logging a call. This is to be set prior to loading the view.
The code is working but it is not taking into account my time zone, it is an hour behind and in uk time GMT.
How do I ensure the time zone is correct.
class CustomCallsController extends SugarController
{
public function action_log_inbound()
{
global $timedate;
if(!isset($timedate) || empty($timedate))
{
$timedate = new TimeDate();
}
// get user for calculation
$user = (empty($user)) ? $this->user : $user;
$this->bean->direction = 'Inbound';
$this->bean->date_start = $timedate->asUser($timedate->getNow(), $user);
echo $this->bean->date_start;
$this->view = 'edit';
}
}