Date & Time


  1. Which of these formatting strings of SimpleDateFormat class is used to print week of the year?











  1. 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.


  1. Which of these formatting strings of SimpleDateFormat class is used to print AM or PM in time?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    By using format string “a” we can print AM/PM in time.



  1. Which of these class allows us to define our own formatting pattern for dates and time?











  1. 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.


  1. Which of these method returns an instance of DateFormat that can format time information?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    getTimeInstance() method returns an instance of DateFormat that can format time information.



  1. Which of this class can be used to format dates and times?











  1. 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.