#12 Java Date & Time | Hackerrank Java Solutions

preview_player
Показать описание
Thanks if u r Watching us....
#Python #Dev19 #HackerankSolutions #C #C++ #Java #Python #C
Please Subscribe Us ....
Рекомендации по теме
Комментарии
Автор

This is not a good question, it forces people to use this ancient calendar class from the 90s back when java was 1.1.
instead use the localDate class. We're in 2021 and java 15 is here. why should we use this ancient tools to solve problems.

import java.time.LocalDate; // write this part. this is very important and in order to use it you have to change from java 7 to java 8 in the editor.


public static String findDay(int month, int day, int year) {
LocalDate date = LocalDate.of(year, month, day);
String str =
return str;
}

MahmudHasan-lhov
Автор

import java.time.LocalDate;
class Result {




public static String findDay(int month, int day, int year) {
return LocalDate.of(year, month, day).getDayOfWeek().name();

}

}

kishorereddy
Автор

how did you make changes to all 'calender' word at once?

sumitkale
Автор

My Solution is the below one

// public static String findDay(int month, int day, int year) {
// Calendar cal=Calendar.getInstance();

// cal.set(Calendar.MONTH, month-1);
// cal.set(Calendar.DAY_OF_MONTH, day);
// cal.set(Calendar.YEAR, year);
// String dayOfWeek=cal.getDisplayName(month, day, Locale.ROOT).toUpperCase();
// return dayOfWeek;
//
The program's solution in the video throws: -
Exception in thread "main" 217
at
at

shivamchoudhary
Автор

getDay method call kare to day milega aesa likha hey

tirthpatel