Page 1 of 1

Use time zone in API actions

Posted: Tue Dec 08, 2020 5:28 am
by sticcino

locale en -- timzezone set to "us/eastern"

just noticed the time returned is 5 hours ahead.

Current Eastern time is 4:20 pm

CurrentTime() = 21:20:41
CurrentDateTime() = 12-7-2020, 21:20

trying to retrieve in userfn.php inside Api_Action $api-post() functions


Re: time not correct in userfn.php calls

Posted: Tue Dec 08, 2020 8:53 am
by mobhar

Make sure you have already used the correct timezone. Try US/Eastern instead of us/eastern.

For more info, please visit: https://www.php.net/manual/en/timezones.others.php


Re: Use time zone in API actions

Posted: Wed Dec 09, 2020 9:25 am
by sticcino

you need to add:

global $Language;
$Language = Container("language");

in your api->get/post functions in order to get the timezone/time information.