I wanted just to use Yii::$app->formatter->asDate() to format how the datetime should be displayed without converting to another timezone; but what I noticed is it also converting the passed datetime to the application timzone.
So how can I block that behaviour and just receive my datetime as it but displayed accordling to the application language(I thought formatter is just for displaying accordling to the current language)?
I’ve noticed that Yii::$app->formatter->asDate() is converting the date from the one timezone to the application’s current timezone.
What I want is just to format date according to this format php:D d-M-Y H:i:s without converting the date to a timezone because it display the day and month in current language.
To it I have to specify the timezone explicitly since the default timezone(UTC) is not the same with my timezone(africa/Nairobi). Here is how to specify:
Yii::$app->formatter->asDatetime('2016-3-1 10:08:27' . Yii::$app->getTimeZone(),'php:D d-M-Y H:i:s');
//Result is 2016-3-1 10:08:27
I have UCI version 51.1 on my local computer but online UCI version 54.1; the problem is the previous solution is working on my local computer but online if I add the timezone it displays the date in UTC and if I remove the timezone it’s displaying the date correctly.
I try to accuse the version but have not found enough theory to support the accusion.
I really don’t get it!!!! I have to pass through all my code to remove the timezone I added; before doing that I wanted to know if my accusation is correct and move on.