Menu
Question Index
...

Write a program to print date in various formats according to given date object.

Input (Date) Printed Output
2012-Feb-02 02-Feb-2012
02 February 2012
12/2/02
02-2-2012
1947-Aug-15 15-Aug-1947
15 August 1947
47/8/15
15-8-1947
2005-Dec-26 26-Dec-2005
26 December 2005
05/12/26
26-12-2005
2013-Jan-26 26-Jan-2013
26 January 2013
13/1/26
26-1-2013
2012-Nov-19 19-Nov-2012
19 November 2012
12/11/19
19-12-2012


import java.util.*;
import java.text.*;
class DateInVariousFormats
{
    public static void main(String s[])
    {
        Calendar calendar = new GregorianCalendar();
        calendar.set(2012, 1, 2);
        printDateInVariousFormats(calendar.getTime());

    }


    public static void printDateInVariousFormats(Date date) {
    }

}

Doubts

Problems

Topic: Locale Class In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App