Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

return day from date in java

 /*
     * 'findDay' function
     *
     * The function is expected to return a STRING.
     * The function accepts following parameters:
     *  1. INTEGER month
     *  2. INTEGER day
     *  3. INTEGER year
     */

public static String findDay(int month, int day, int year) {
        SimpleDateFormat simpleDateformat = new SimpleDateFormat("EEEE");
        
        Date date = new GregorianCalendar(year, month - 1, day).getTime();
        String dayText = simpleDateformat.format(date);
    
        return dayText.toUpperCase(); 
}
 
PREVIOUS NEXT
Tagged: #return #day #date #java
ADD COMMENT
Topic
Name
8+9 =