Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Date now = new Date();
  2. Map<String, String> myDate = new LinkedHashMap<String, String>();
  3. auctionDate.put("", "All");
  4. SimpleDateFormat sdfDDMMYYYYEEE = new SimpleDateFormat("dd/MM/yyyy (EEE)");
  5. SimpleDateFormat sdfDDMMYYYY = new SimpleDateFormat("dd/MM/yyyy");
  6. SimpleDateFormat sdfEEE = new SimpleDateFormat("EEE");
  7. for (int i = 0; i < 5; i++) {
  8. if (sdfEEE.format(now).equals("Sun")) {
  9. now.setTime(now.getTime() + 86400000);
  10. i--;
  11. continue;
  12. }
  13. myDate.put(sdfDDMMYYYY.format(now), sdfDDMMYYYYEEE.format(now));
  14. now.setTime(now.getTime() + 86400000);
  15. }
  16. System.out.println(myDate);
  17.  
  18. {=All, 07/07/2015=07/07/2015 (Tue), 08/07/2015=08/07/2015 (Wed), 09/07/2015=09/07/2015 (Thu), 10/07/2015=10/07/2015 (Fri), 11/07/2015=11/07/2015 (Sat)}
  19.  
  20. ["":"All", "07/07/2015" : "07/07/2015 (Tue)", "08/07/2015" : "08/07/2015 (Wed)", "09/07/2015" : "09/07/2015 (Thu)", "10/07/2015" : "10/07/2015 (Fri)", "11/07/2015" : "11/07/2015 (Sat)"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement