DBCreator
(DBCreator)
March 16, 2020, 8:55pm
1
If in my config/main.php I use
'timeZone' => 'America/Montreal',
and in my index.php view file I use
\Yii::$app->formatter->asDate($model->StartDt, 'M/d/Y');
I get 3/17/2020
Yet, if my config/main.php uses
'timeZone' => 'EST',
then my index.php view returns
3/16/2020
EST = America/Montreal, no?
I should add that the database value is ‘2020-03-16 23:00:00’
tri
(tri - Tommy Riboe)
March 16, 2020, 9:22pm
2
DBCreator
(DBCreator)
March 16, 2020, 11:35pm
3
Not sure.
EDT and EST both work, but I don’t understand why America/Montreal or America/New_York do not since they are both EST/EDT.
Yet, even using America/Montreal or America/New_York, the following works fine
\Yii::$app->formatter->asDateTime($model->StartDt . Yii::$app->getTimeZone(), 'M/d/Y HH:mm');
If my default config/main.php specifies a timeZone/defaultTimeZone, then why would adding it specifically to the asDate/asDateTime functions make any difference? Should that not already be the case since it is my default?