如何计算周数给定日期的Android [英] How to calculate week number for given date Android
本文介绍了如何计算周数给定日期的Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从给定日期的当前周数。即如果我输入日期为2013年1月3日,然后我应该得到的周数是9。
I am trying to get the the current week number from the given date. i.e. If I enter the date as 01/03/2013 then i should get the week number which is 9..
请帮我寻找解决方案。
谢谢..
阿布舍克..
推荐答案
您可以创建该日期的日历对象并获取本周calendar.get(日历。WEEK_OF_YEAR)。该API描述如下:<一href=\"http://developer.android.com/reference/java/util/Calendar.html#WEEK_OF_YEAR\">http://developer.android.com/reference/java/util/Calendar.html#WEEK_OF_YEAR
You can create a Calendar object for that date and get the week with calendar.get(Calendar. WEEK_OF_YEAR). The API is described here: http://developer.android.com/reference/java/util/Calendar.html#WEEK_OF_YEAR
这篇关于如何计算周数给定日期的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文