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

create an expandable grid view in Yii2
Yii2 - Get Current Action ID in main.php
Yii2 Validate Only Create Action
Yii2 preselect radiobutton value
how to set URL (admin instead of backend/web) in yii2 advanced application
yii2 AR find via 2 relative tables
Form validation rule does not render custom message
Class not found in _before function of Codeception TestCase
YII2 Gridview doesn't return selected rows (Uncaught TypeError: Cannot read property 'selectionColumn' of undefined yii.gridView.js:140)
Remove query string to Yii URL
cant get data was Post from android to Yii2 action
Loading part of form via ajax. Extra form tag. Yii2
How to Using Yii2 BaseImage class crop image from center
How to configure global uploadPath and uploadUrl in Yii2?
How to use where() condition with min() in ActiveQuery
Class 'yii\jui\DatePicker' not found (Not a duplicate one)!

Categories

HOME
pandas
vim
include
lodash
fme
xmpp
pivotal-cloud-foundry
contact
applepay
windows-10-universal
midi
apache-cayenne
decomposition
carthage
netflix
vaadin7
transformation
emulator
grails3
kryo
mmap
tibco-mdm
jndi
numerical-methods
facet
pingfederate
spring-mybatis
log4js-node
flink-streaming
lightswitch-2013
tinymce-4
windows-dev-center
wallpaper
http-referer
nssegmentedcontrol
fusionpbx
jquery-bootgrid
hockeyapp
gesture
service-discovery
tasker
trim
sas-visual-analytics
preconditions
reactive-cocoa-5
galleria
jsch
setter
jxcore
typed-lambda-calculus
webdriverjs
url-pattern
probability-density
savon
py2app
ctest
jwplayer7
flash-cs5
python-stackless
cloudbees
netmq
freelancer.com-api
intel-fortran
wordml
php-ci
arcanist
sortedlist
sonarqube5.1.2
umbraco6
coldbox
google-style-guide
dml
phpthumb
reactfx
balanced-payments
mysqltuner
runtime.exec
blending
bulkloader
yui-compressor
angularjs-controller
multipage
window-management
nsobject
deobfuscation
vdsp
yetanotherforum
self-extracting
pyinotify
visitor-statistic
substrings

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App