I have two dates.Got them from something like......
Calendar c=Calendar.getInstance();
year=c.get(c.YEAR);
month=c.get(c.MONTH);
month++;
date=c.get(c.DATE);
and other date is broken into date2,month2
Now I want to see if both of them are in the same week.
It's possible through lots of calculation and logic.Problem occurs when 1st date is suppose 03 March and 2nd date is 28Feb. Both of them are in same week but difficult to compare/check that. So I want to know if there is any built in function or any way to compare them easily.Please help..........
Compare dates if greater than another date with formula 2. Select a blank cell which is corresponding to the first date cell in the Date column such as G2. Then copy and paste formula =IF(A2>$F$2, "YES", "NO") into the Formula Bar and press the Enter key.
I ended up using
date1.with(previousOrSame(MONDAY)).equals(date2.with(previousOrSame(MONDAY)))
assuming that weeks start on Monday.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With