Why new Date() was deprecated in JAVA?

Here is the answer:

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

import java.text.DateFormat;

public class UsingCalendar {

public static void main(String[] args) {

Calendar calendar = Calendar.getInstance();
DateFormat df = DateFormat.getDateTimeInstance( DateFormat.FULL, DateFormat.FULL, Locale.KOREAN );

System.out.println( df.format(calendar.getTime()) );



2002년 7월 30일 화요일 오전 03시46분56초 KST

Press any key to continue…

Can you point out differences between new Date() and Calendar.getInstance().getTime()? Date class was only for american_america. But encapsuling formatting of Calendar makes i18n real.

Similar Posts:

Post a Comment

Your email is never published nor shared.