?? rightnow.java
字號(hào):
import java.util.*;
import java.text.SimpleDateFormat;
public class Rightnow
{
public static void main (String args[])
{
Date today = new Date(); //當(dāng)前日期和時(shí)間
System.out.println("當(dāng)前時(shí)間="+today.toString());
SimpleDateFormat sdf;
sdf= new SimpleDateFormat("yyyy年MM月dd日hh時(shí)mm分ss秒 a EEEEE");
System.out.println(" 即 "+sdf.format(today));
long lg=System.currentTimeMillis(); //當(dāng)前時(shí)間的毫秒數(shù)
Date tomorrow = new Date(lg+24*60*60*1000);
System.out.println(" 明天="+sdf.format(tomorrow));
Calendar now = Calendar.getInstance();
int year =now.get(Calendar.YEAR); //年份
int month=now.get(Calendar.MONTH)+1; //月份
int day = now.get(Calendar.DATE); //日期
System.out.print("今天="+year+"年"+month+"月"+day+"日");
int week = now.get(Calendar.DAY_OF_WEEK); //星期
switch (week)
{
case 1: System.out.println(" 星期日");break;
case 2: System.out.println(" 星期一");break;
case 3: System.out.println(" 星期二");break;
case 4: System.out.println(" 星期三");break;
case 5: System.out.println(" 星期四");break;
case 6: System.out.println(" 星期五");break;
case 7: System.out.println(" 星期六");break;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -