Tuesday, August 13, 2013

Re: How can I get the number of week in the year

Try to use a 'W' parameter in yours timestamp object manipulations:

PHP pure: echo date('W', strtotime('2013-08-13'));

in CakePHP:
// called via TimeHelper
echo $this->Time->format('W', $timestamp);

// called as CakeTime
App::uses('CakeTime', 'Utility');
echo CakeTime::format($timestamp, 'W');





2013/8/12 Ian russel Adem <ian.russel@yahoo.com>
How can I get the number of week in the year of a given date?
Example:
Date = 12/22/1998 -> number of week = 52

i want to build a table that has 52 or 53 week for a year.this is a loan database and has a batch number that is equal to one week,which start on mondays.for example,monday to sunday is batch number 1,what is the correct code so that in the next monday,the batch number will automatically incremented to next week number?..

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: