返回列表 發帖
import java.lang.*;
import java.util.*;
public class calendar{
          public static void main(String[] args){
              System.out.println("----------------------");
              System.out.println("       當地時間       ");
              System.out.println("----------------------");
              String apm[] = {"上午","下午"};
              String week[] = {"","星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
                                Calendar now = Calendar.getInstance();
                                System.out.println(now.get(Calendar.YEAR)+"/"+now.get(Calendar.MONTH)+"/"+now.get(Calendar.DATE)+" "+apm[now.get(Calendar.AM_PM)]+" "+now.get(Calendar.HOUR)+":"+now.get(Calendar.MINUTE));
                                System.out.println(now.get(Calendar.YEAR)+"/"+now.get(Calendar.MONTH)+"/"+now.get(Calendar.DATE)+" "+apm[now.get(Calendar.AM_PM)]+" "+now.get(Calendar.HOUR)+":"+now.get(Calendar.MINUTE)+":"+now.get(Calendar.SECOND));
                                System.out.println(now.get(Calendar.YEAR)+"年"+now.get(Calendar.MONTH)+"月"+now.get(Calendar.DATE)+"日 "+apm[now.get(Calendar.AM_PM)]+now.get(Calendar.HOUR)+"時"+now.get(Calendar.MINUTE)+"分"+now.get(Calendar.SECOND)+"秒");       
                                System.out.println(now.get(Calendar.YEAR)+"年"+now.get(Calendar.MONTH)+"月"+now.get(Calendar.DATE)+"日 "+week[now.get(Calendar.DAY_OF_WEEK)]+apm[now.get(Calendar.AM_PM)]+now.get(Calendar.HOUR)+"時"+now.get(Calendar.MINUTE)+"分"+now.get(Calendar.SECOND)+"秒");
                }
}
離離草原上
一歲一枯榮
野火燒不盡
春風吹又生

TOP

返回列表