chiarimenti su dateFormat


sono un neofita di Yii, quindi scusatemi per la mia poca scaltrezza.

Ho u dubbio atroce, ho definito nel nel config/main.php la seguente proprietà

'language'=>'it_it', // Visualizzare i messaggi di errore in lingua italiana.

ma quando richiedo un

echo Yii::app()->locale->dateFormat;

mi restituisce "[color="#555555"][font="Arial, Helvetica, sans-serif"][size="2"]dd/MMM/y" …[/size][/font][/color]

[color="#555555"][font="Arial, Helvetica, sans-serif"] [/font][/color]

[color="#555555"][font="Arial, Helvetica, sans-serif"][size="2"]Come posso far si che il mio applicativo utilizzi di base un formato data del tipo "dd/MM/yyyy" ?[/size][/font][/color]

[color="#555555"][font="Arial, Helvetica, sans-serif"] [/font][/color]

[font="Arial, Helvetica, sans-serif"][size="2"][color="#555555"]Grazie anticipatamente[/color][/size][/font]

[font="Arial, Helvetica, sans-serif"][size="2"][color="#555555"]Francesco[/color][/size][/font]

Yii::app()->getDateFormatter()->>format('yyyy-MM-dd',$timestamp); // use whichever you want

You can also configure it in config/main.php

thanks, everybody …

But the question still remain… why when i define language it_it the date format is dd/MMM/y, if i leave main.php without language definition the date format is yyyyy/MM/dd

The italian date format is dd/MM/yyyyy…


As Zaccaria says, you can configure the way date format or any i18n related configuration on your main.php.

But, if you wish to find out the reason why you have that, you need to go to the YII Framework folder > i18n > it_it.php . There is a section there that you can easily override (sorry for pointing that out again)

'dateFormats' => 

  array (

    'full' => 'EEEE d MMMM y',

    'long' => 'dd MMMM y',

    'medium' => 'dd/MMM/y',

    'short' => 'dd/MM/yy',


  'timeFormats' => 

  array (

    'full' => 'HH:mm:ss zzzz',

    'long' => 'HH:mm:ss z',

    'medium' => 'HH:mm:ss',

    'short' => 'HH:mm',


  'dateTimeFormat' => '{1} {0}',

If you believe there is an issue with this format, please inform qiang and its team about that by posting an issue.


[font=arial, sans-serif][size=6]no, no thanks you have been really helpful…[/size][/font]

[font=arial, sans-serif][size=6]Francesco[/size][/font]