Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Joda Time, Get week days [duplicate]

Tags:

java

jodatime

How to make the local date count only week date?

For example

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

I am look for a way to remove the weekends?

like image 386
vijay Avatar asked Mar 11 '13 12:03

vijay


1 Answers

Use the getDayOfWeek() method. Return will be as follows. Inorder to get only week days.. you just need to check whether the return value is less than or equal to 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;
like image 57
Joe2013 Avatar answered Oct 20 '22 00:10

Joe2013