note 123395 rejected from intldateformatter.format by cmb

From: Date: Mon, 03 Dec 2018 08:55:29 +0000
Subject: note 123395 rejected from intldateformatter.format by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209845@lists.php.net to get a copy of this message
Note Submitter: ndpatelce05 at gmail dot com ---- Hello, I am getting wrong date after format for Last day of year. Please check below code <?php $input = '2018-12-31'; $zone = new \DateTimeZone('Asia/Calcutta'); $date1 = new \DateTime($input, $zone); $timezone1 = $date1->getTimezone(); $fmt = new \IntlDateFormatter( 'en_US', 0, 0, $timezone1, NULL, 'M/d/Y' ); echo 'First Formatted output with pattern is ' . $fmt->format($date1); ?> // OUTPUT First Formatted output with pattern is 12/31/2019 <?php $input = '2018-12-31'; $zone = new \DateTimeZone('Asia/Calcutta'); $date1 = new \DateTime($input, $zone); $timezone1 = $date1->getTimezone(); $fmt = new \IntlDateFormatter( 'en_US', 0, 0, $timezone1, NULL, 'M/d/Y' ); echo 'First Formatted output with pattern is ' . $fmt->format($date1); ?> // OUTPUT First Formatted output with pattern is 12/31/2018 Thanks Nirav Patel

« previous php.notes (#209845) next »