java – Joda时间,获取工作日[复制]

参见英文答案 > joda time – add weekdays to date4个
如何使本地日期只计算周日期?

例如

LocalDate date = new LocalDate();
date.plusDays(10); //it returns plus days including sat and sun as 2013-03-21
//i am looking for a way
date.plusDays(10); //should return as 2013-03-26

我想找个方法去除周末?

解决方法

使用getDayOfWeek()方法.回报如下.为了只获得工作日…你只需要检查返回值是否小于或等于5.
public static final int MONDAY = 1;
public static final int TUESDAY = 2;
public static final int WednESDAY = 3;
public static final int THURSDAY = 4;
public static final int FRIDAY = 5;
public static final int SATURDAY = 6;
public static final int SUNDAY = 7;

相关文章

应用场景 C端用户提交工单、工单创建完成之后、会发布一条工...
线程类,设置有一个公共资源 package cn.org.chris.concurre...
Java中的数字(带有0前缀和字符串)
在Java 9中使用JLink的目的是什么?
Java Stream API Filter(过滤器)
在Java中找到正数和负数数组元素的数量