Problem 2362. What day is it?

Solution 2867882

Submitted on 22 Aug 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
today = java.util.Date; c = java.util.Calendar.getInstance(); c.setTime( today ); dayOfWeek = c.get(java.util.Calendar.DAY_OF_WEEK); switch dayOfWeek case 1 dayOfWeek = 'Sunday'; case 2 dayOfWeek = 'Monday'; case 3 dayOfWeek = 'Tuesday'; case 4 dayOfWeek = 'Wednesday'; case 5 dayOfWeek = 'Thursday'; case 6 dayOfWeek = 'Friday'; case 7 dayOfWeek = 'Saturday'; end assert(strcmp(dayOfWeek,day_of_week()))

Error using datetime (line 640) Could not recognize the date/time format of 'DDD'. You can specify a format using the 'InputFormat' parameter. If the date/time text contains day, month, or time zone names in a language foreign to the 'en_US' locale, those might not be recognized. You can specify a different locale using the 'Locale' parameter. Error in day_of_week (line 2) y = datetime('DDD'); Error in Test1 (line 21) assert(strcmp(dayOfWeek,day_of_week()))

Suggested Problems

More from this Author5

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!