コード例 #1
0
ファイル: I18n.php プロジェクト: margery/thelia
 /**
  * Create a \DateTime from a date picker form input
  * The date format is the same as the one from the current User Session
  * Ex : $lang = $session->getLang()
  *
  * @param Lang   $lang Object containing date format
  * @param string $date String to convert
  *
  * @return \DateTime
  */
 public function getDateTimeFromForm(Lang $lang, $date)
 {
     $currentDateFormat = $lang->getDateFormat();
     return \DateTime::createFromFormat($currentDateFormat, $date);
 }