Date & Time
- Which of these formatting strings of SimpleDateFormat class is used to print week of the year?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
By using format string “w” we can print week in a year whereas by using ‘W’ we can print week of a month.
- Which of these formatting strings of SimpleDateFormat class is used to print AM or PM in time?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
By using format string “a” we can print AM/PM in time.
- Which of these class allows us to define our own formatting pattern for dates and time?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The DateFormat is a concrete subclass of DateFormat. It allows you to define your own formatting patterns that are used to display date and time information.
- Which of these method returns an instance of DateFormat that can format time information?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
getTimeInstance() method returns an instance of DateFormat that can format time information.
- Which of this class can be used to format dates and times?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
DateFormat is an abstract class that provides the ability to format and parse dates and times.