trntv / yii2-datetime-widget

Yii2 Date/Time Widget
8 stars 14 forks source link

Indonesian format #11

Closed ahmadfadlydziljalal closed 7 years ago

ahmadfadlydziljalal commented 7 years ago

Dear..

How to add indonesian format in "phpDatetimeFormat", which is dd-MM-yyyy HH:MM ?

ahmadfadlydziljalal commented 7 years ago

Also, in my database, I have field : 2016-10-25 09:00:00

My app in this case will be updated this datetime, but why, the date viewing : 25/10/2016 16:00 even I use phpDatetimeFormat : "dd/MM/yyyy HH:mm"

perhaps, all hours +7

trntv commented 7 years ago

+7 is an issue with your timezone settings, try to add T to your format to see current timezone

Change this to change format:

<?php echo trntv\yii\datetime\DateTimeWidget::widget([
    'phpDatetimeFormat' => 'dd-MM-yyyy HH:mm',
    'phpMomentMapping' => [
        'dd-MM-yyyy HH:mm' => 'DD-MM-YYYY HH:mm'
    ]
]) ; ?>