Open Source & stuff 

Salix.gr

User login

Symfony date input

Want to get date parts correctly I18N support from symfony's date input?

// get locale settings
$I18n_arr = $this->_get_I18n_date_locales($this->getUser()->getCulture());
// get request parameter, actually is an array
$t = $this->getRequestParameter('start_date');

// implode the $t array with the correct seperator for the user locale
// pass the string to I18N's getDateForCulture function to split it
// correctly according to user culture
list($d, $m, $y) =
$this->getContext()->getI18N()->getDateForCulture( implode($I18n_arr['date_seperator'],$t)
, $this->getUser()->getCulture());


All Rights Reserved 2006-2010 Salix.gr | Hosting by e-emporio