Date and time calculations, and format date in different locales with different date styles. : Date « Utility Classes « SCJP






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

public class MainClass{
    public static void main(String[] argv){
        Calendar c = Calendar.getInstance(); 
        Locale loc = new Locale("en","us"); 
        Date d = c.getTime();  
        DateFormat df = DateFormat.getDateInstance(0,loc);
        //Use the format() method to create formatted dates:
        String s = df.format(d); 

    }
}








8.26.Date
8.26.1.How Date, GregorianCalendar, and TimeZone objects are created and how to use their methods to access date/time information.
8.26.2.Get the current date and time.
8.26.3.Date and time calculations, and format date in different locales with different date styles.
8.26.4.Find out how long it took for a trillion milliseconds to pass, starting at January 1, 1970
8.26.5.The Calendar Class
8.26.6.The DateFormat Class
8.26.7.DateFormat.format(), DateFormat.parse()