yii2


Display time based on country in yii2


I've used timestamp behavior to display time and it works fine. How can the time display based on country?
Your question it is rather general. Your should take a look at internationalization http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html#internationalization and Data formattimg http://www.yiiframework.com/doc-2.0/guide-output-formatting.html#data-formatting as you can see you can localize date fornmat
Yii::$app->formatter->locale = 'en-US';
echo Yii::$app->formatter->asDate('2014-01-01'); // output: January 1, 2014
Yii::$app->formatter->locale = 'de-DE';
echo Yii::$app->formatter->asDate('2014-01-01'); // output: 1. Januar 2014
Yii::$app->formatter->locale = 'ru-RU';
echo Yii::$app->formatter->asDate('2014-01-01'); // output: 1 января 2014 г.
and or configure formatter components
return [
'components' => [
'formatter' => [
'dateFormat' => 'dd.MM.yyyy',
'decimalSeparator' => ',',
'thousandSeparator' => ' ',
'currencyCode' => 'EUR',
],
],
];

Related Links

yii2 stripe include error (class not found)
Restricting controller action to creator of post in Yii2
Yii2 Email How to set sender name
How to passing parameter to afterSave() Method in yii2?
search for multiple keywords in the same field in Yii2
What is function behaviors in SiteController.php?
In YII2 validation rules I need something opposite to compare
How to add sendgrid mailer function in yii2?
Yii2 dataprovider- exclude first 2 elements
Many to many relationships in Yii2
yii2 swiftmailer link does not work
Call to a member function saveAs() on null (I can not update if I do not select an image)
yii2 dataProvider- offset in dataprovider doesn't work [duplicate]
Yii2 Active Record get the latest record
how to show json formated data in GridView
How to convert HTML page to image in yii2

Categories

HOME
arduino-uno
oracle11g
activiti
push-notification
session
tesseract
jsrender
twitter-bootstrap-4
jpeg
sql-server-2016
azure-storage-tables
add
facebook-messenger-bot
dacpac
maude-system
phaser
windows-server-2012
dynamics-crm-online
ab-testing
flux
nhibernate-envers
amazonsellercentral
physics-engine
arabic
mustache.php
realex-payments-api
format-specifiers
php-openssl
javacv
uninstall
procdump
airconsole
android-kernel
y86
environment-modules
wpf-controls
hockeyapp
serverside-rendering
webdriver-manager
graphenedb
slick-3.0
websphere-mq-fte
xml-documentation
revapi
python-webbrowser
lowpass-filter
nstextview
directory-structure
composite-key
qtwebview
blacklist
yt-project
gridpane
httplistener
database-optimization
intrusion-detection
mikroc
flash-cs5
testng-dataprovider
make-install
uid
wso2cloud
cakephp-3.1
php-ci
createprocessasuser
pretty-print
lustre
tablelayout
network-interface
angularjs-ng-click
cctv
rdtsc
xojo
system.net.webexception
jboss-weld
openlaszlo
prettify
ivyde
ms-project-server-2010
blending
jplaton
flashvars
wsdl-2.0
simba
broken-links
cascalog
hosts-file
ocx
hgsubversion
custom-backend
adk
libc++
psi
invite
sql-server-profiler
revisions
project-hosting
paul-graham

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App