import
java.text.SimpleDateFormat;
import
java.util.GregorianCalendar;
public
class
GregorianCalendarToCalendar {
public
static
void
convert(
GregorianCalendar gregorianCalendarDate)
{
SimpleDateFormat formattedDate
=
new
SimpleDateFormat(
"dd-MMM-yyyy"
);
String dateFormatted
= formattedDate.format(
gregorianCalendarDate.getTime());
System.out.print(
"SimpleDateFormat: "
+ dateFormatted);
}
public
static
void
main(String[] args)
{
GregorianCalendar gcal =
new
GregorianCalendar();
gcal.set(GregorianCalendar.YEAR,
2019
);
gcal.set(GregorianCalendar.MONTH,
03
);
gcal.set(GregorianCalendar.DATE,
03
);
System.out.println(
"Gregorian date: "
+ gcal.getTime());
convert(gcal);
}
}