JAVA获取指定日期是星期几
2024-08-29 03:58:20
/**
* 获取指定日期是星期几<br>
*
* @param date
* @return 指定日期是星期几
*/
public static String getWeekOfDate(Date date) {
String[] weekDays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (w < 0)
w = 0;
return weekDays[w];
}
最新文章
- An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
- 42. Trapping Rain Water
- Java集合类之ArrayList
- 未能加载文件或程序集";Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad
- Spring、实例化Bean的三种方法
- traceroute工作原理
- Configure Always On Availability Group for SQL Server on RHEL——Red Hat Enterprise Linux上配置SQL Server Always On Availability Group
- Findbug在项目中的运用--提高代码质量
- mysql监控执行的sql语句
- poj2054 Color a Tree
- 爬虫3 requests基础之 乱码编码问题
- 2018年值得关注的10大JavaScript动画库
- hadoop2.7.7 测试安装 centos7
- fork、vfork、clone
- 托管博客到coding或者github
- SQL Server 2014内存优化表的使用场景(转载)
- SCRUM 12.03
- DNS解析原理和流程
- Unix下cp、tar、sudo命令的使用
- PHP session用redis存储