| |
8.26.3.Date and time calculations, and format date in different locales with different date styles. |
|
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);
}
}
|
|
|