DateType वर्ग के कोड पर देखो दिखा रहा है, यह है:
संपादित करें:
$builder->add('dateOfBirth', 'birthday', array(
'format' => 'dd - MM - yyyy',
'widget' => 'choice',
'years' => range(date('Y'), date('Y')-70)
));
EDIT2: यहाँ कोड मैं अपने प्रपत्र कक्षा में उपयोग करें प्रारूप विकल्प:
$allowedFormatOptionValues = array(
\IntlDateFormatter::FULL,
\IntlDateFormatter::LONG,
\IntlDateFormatter::MEDIUM,
\IntlDateFormatter::SHORT,
);
// If $format is not in the allowed options, it's considered as the pattern of the formatter if it is a string
if (!in_array($format, $allowedFormatOptionValues, true)) {
if (is_string($format)) {
$defaultOptions = $this->getDefaultOptions($options);
$format = $defaultOptions['format'];
$pattern = $options['format'];
} else {
throw new CreationException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom pattern');
}
}
$formatter = new \IntlDateFormatter(
\Locale::getDefault(),
$format,
\IntlDateFormatter::NONE,
\DateTimeZone::UTC,
\IntlDateFormatter::GREGORIAN,
$pattern
);
UPDAT ई
$builder->add('dateOfBirth', 'birthday', array(
'format' => 'dd - MMMM - yyyy',
'widget' => 'choice',
'years' => range(date('Y'), date('Y')-70)
));
क्या आप इस प्रश्न में जोड़े गए कोड का उपयोग करके एक उदाहरण दे सकते हैं? –
धन्यवाद, आपके त्वरित उत्तर के लिए, लेकिन मैंने पहले से ही कोशिश की है, और 'एफ' का अर्थ सिम्फनी द्वारा नहीं किया जा रहा है। –
यह इसलिए होना चाहिए क्योंकि 'दिनांक() 'वास्तव में उपयोग नहीं किया जाता है। यह वर्ग: http://www.php.net/manual/en/class.intldateformatter.php का उपयोग – greg0ire