I could not find a method in Flex Date object to get the week of year (1 to 52)
What is the best way to find this? Is there any useful library for flex for such date operations like JodaTime in Java.
I could not find a method in Flex Date object to get the week of year (1 to 52)
What is the best way to find this? Is there any useful library for flex for such date operations like JodaTime in Java.
Before d is divided by 7, it should be decremented by 1. Otherwise, Saturday would go to next week.
Take 2011 as example, 1/1/2011 is Saturday. It should be week in 0, and 1/8/2011 should be in week 1.
If d is not decremented, then 1+6=7/7=1, and 8+6=14/7=2. So these are not correct.
I just want to point out that there is an error in the above solution.
should be
in order to work properly.
Nevertheless thanks for the solution, it helped me a lot :)
I tried to use Amarghosh's function but I had issues with the UTC values. And with the first days of a year as well.
Therefore I modified the setting of jan1 (depending on sundays) and the final week calculation
Here is the function I use, based on Amarghosh's one :
I'm not aware of a library, but this function will get you the week index (zero based).