yii2 have a function that transform something like ‘1671380485’ to ‘December 21, 2022’.
Yii::$app->formatter->asDate('1671380485', 'medium');
Do yii2 have a function that will make Reverse effect? For example transform ‘2022-12-21’ to int(11)?
yii2 have a function that transform something like ‘1671380485’ to ‘December 21, 2022’.
Yii::$app->formatter->asDate('1671380485', 'medium');
Do yii2 have a function that will make Reverse effect? For example transform ‘2022-12-21’ to int(11)?
2
Answers
I believe PHP’s strtotime() function is what you are looking for:
Yes, you can use the built-in formatter:
Read more here: https://www.yiiframework.com/doc/api/2.0/yii-i18n-formatter#asTimestamp()-detail