Home » JAVA Programming » Date & Time » Question
  1. What is the output of this program?
    import java.text.*;
    import java.util.*;
    public class DateFormatting_Example
    {
    public static void main(String args[])
    {
    Date d = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("z");
    System.out.print(sdf.format(d));
    }
    }
    1. z
    2. UTC
    3. Nov
    4. Tue
    5. None of these
Correct Option: B

format string “z” is used to print time zone.



Your comments will be displayed only after manual approval.