When creating a task due_at time has an extra hour added

Hi, I seem to be experiencing an extra hour being added to the due_at field when I attempt to create a task via the Asana API.

The snippet of PHP code I use to send the date and time through is as follows:-

$asanaData_DevelopmentTask["due_at"] = date("Y-m-d\TH:i:s\Z", strtotime( $this->request->data['form_task_development_due_date'] . " " . $this->request->data['form_task_development_due_time'] ));

Like I say the task get created fine and the due at date and time get set correctly, only that the ‘time’ portion has an extra hour added e.g. I set 10:30 for the time, but Asana reports it as 11:30.

Any tips here would be most appreciated.

Regards

For me that would be a timezone / time on the server issue. You are using the date method from PHP, so that will send the date of your server. Are you sure it has the date you expect?

Hi Bastien, thanks for your reply. Yes that too did cross my mind so I’ve tried a few things such as setting this function before I attempt to use the date function:-

date_default_timezone_set(‘UTC’);

Also I’m logging the output of ‘date’ so I can see what’s being produced and sent to Asana, in this case following the same example, I get:-

2020-05-29T10:30:00Z

The actual due date in Asana gets set correctly, its just the ‘time’ portion that has 1 hour added to it…

Regards

So you are saying that when you send 10.30 to Asana they actually record 11.30 on the task?

Hi Bastien, yes exactly that, or at least that’s what I can see happening.

Regards

cc @Joe_Trollo maybe you have an idea?

Asana’s timezone is UTC. And you’re sending it a UTC timezoned date/time. So all is good up to this point. When Asana shows you this date/time value on asana’s frontend (in your asana app or in the browser), it shows to you according to you local time zone. So in this case, it seems like your actual local time zone is +1 UTC, which is why it shows it at 11:30 instead of 10:30. I hope this helps!