Yii Framework Forum: chiarimenti su dateFormat - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

chiarimenti su dateFormat come configurare Yii per un corretto utilizzo delle date? Rate Topic: -----

#1 User is offline   Farm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 11

Posted 20 April 2011 - 11:21 AM

Salve,
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 "dd/MMM/y" ...

Come posso far si che il mio applicativo utilizzi di base un formato data del tipo "dd/MM/yyyy" ?

Grazie anticipatamente
Francesco
0

#2 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 20 April 2011 - 02:39 PM

http://www.yiiframew...time-formatting

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

¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#3 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 21 April 2011 - 12:58 AM

You can also configure it in config/main.php
0

#4 User is offline   Farm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 11

Posted 21 April 2011 - 02:54 AM

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...





thanks!


0

#5 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 21 April 2011 - 03:25 AM

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.

Cheers
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
1

#6 User is offline   Farm 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 14-April 11

Posted 21 April 2011 - 05:09 AM

no, no thanks you have been really helpful...
Francesco
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users