java - I need to convert a date in String format to an actual date in order to check if it's Friday -
i have date in string format, in following manner "2016-07-08" (8th july 2016). need check if friday, reason date change , need check if provided date friday. using following code (assume startdate string holds date):
dateformat formatter = new simpledateformat("yyyy-mm-dd"); java.util.date date = formatter.parse(startdate); cal.settime(date); if(cal.get(calendar.day_of_week) == calendar.friday){ system.out.println("it's friday!!!!"); }
i tried outputting value stored in cal, , returning mon jan 04 00:00:00 cet 2016.
capital y
week-year. meant yyyy-mm-dd
(with lower case y
year).
the javadoc lists valid patterns.
Comments
Post a Comment