【Java开源代码栏目提醒】:以下是网学会员为您推荐的Java开源代码-Today.java,希望本篇文章对您学习有所帮助。
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.mwq.stat.tool;
import java.util.Calendar;
/**
*
* @author Administrator
*/
public class Today {
private static final int YEAR;
private static final int MONTH;
private static final int DAY;
static {
Calendar today = Calendar.getInstance();
YEAR = today.get(Calendar.YEAR);
MONTH = today.get(Calendar.MONTH) + 1;
DAY = today.get(Calendar.DAY_OF_MONTH);
}
public static String getDate() {
return YEAR + " 年 " + MONTH + " 月 " + DAY + " 日";
}
}