mercredi 6 juillet 2016

Laravel 5 generation carbon date time with timezone

I have publish ERP site in cloud platform and I want to generate datetime for user assigned timezones.

I am using carbon datetime library to convert. But its gave me bellow issue when i am converting.

$carbon = new Carbon();
$carbon->setTimezone('Asia/colombo');
echo $carbon;           //output is  : 2016-07-06 22:33:05 | Asia/colombo
BUT
echo $carbon->now()     // output is : 2016-07-06 17:03:05 | UTC

Why $carbon->now is giving wrong timezone even I have set timezone in carbon object also....

sorry If I am thinking wrong way.........



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire