|
import java.util.*;
import java.text.*;
public class CLCOMP { public static void main(String[] args) {
Calendar cal = null;
Date myDate = null;
String strDate = null;
cal = Calendar.getInstance();
cal.set( 2006, 0, 14, 18, 31 ,10 );
myDate = cal.getTime();
strDate = DateFormat.getDateInstance().format(myDate);
System.out.println( "現在の日付 : " + strDate );
strDate = DateFormat.getTimeInstance().format(myDate);
System.out.println( "現在の時間 : " + strDate );
strDate = DateFormat.getDateTimeInstance().format(myDate);
System.out.println( "現在の日付・時間 : " + strDate );
} }
| |