Friday, 15 March 2013

zend framework - Get week number according to your locale in Zend_Date -



zend framework - Get week number according to your locale in Zend_Date -

i trying current week number zend framework.

in france, weeks defined :

a week begins on mon (whereas weeks begin on sunday in us).

the first week of year week contains 4th of january.

in 2014, first week begins jan 1st. if utilize in zend framework 1.12 date $zend_date->get(zend_date::week) returns 53 (and not 1). , jan 12th, returns 1 (and not 2)

how can right ? tried alter locale fr-fr didn't work.

regards

tried replicate problem doing

$date1 = new zend_date('2014-01-01'); $date2 = new zend_date('2014-01-12'); $date1->get(zend_date::week) // gives 01 $date2->get(zend_date::week) // gives 02

also tried passing 'fr' locale. gives right answer.

i not sure if it's zend issue.

try php solution:

php > echo date('w',strtotime('2014-01-01')); 01 php > echo date('w',strtotime('2014-01-12')); 02

zend-framework

No comments:

Post a Comment