java的检查,如果日期是每月的第一个星期日 [英] java check if date is first Sunday of the Month
本文介绍了java的检查,如果日期是每月的第一个星期日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找和搜索很多关于这个问题。我真的很愚蠢,当涉及到使用Java Calendar类。
有谁请帮助我展示了如何获取当前时间(在Android手机上),一个简单的方法,检查是否是这个月的第一个星期日或没有。
在code例子//评论都非常欢迎: - )
解决方案
日历CAL = Calendar.getInstance();
如果(Calendar.SUNDAY == cal.get(Calendar.DAY_OF_WEEK)及&放大器; cal.get(Calendar.DAY_OF_MONTH)下; = 7)
I have been looking and searching a lot for this question. I'm really stupid when it comes to using the JAVA Calendar class.
Could anybody please help me to show a simple way of how to get the current time (on the android phone) and check whether is the first Sunday of the month or not.
// Comments in the code examples are very welcome :-)
解决方案
Calendar cal = Calendar.getInstance();
if (Calendar.SUNDAY == cal.get(Calendar.DAY_OF_WEEK) && cal.get(Calendar.DAY_OF_MONTH) <= 7)
这篇关于java的检查,如果日期是每月的第一个星期日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文