code051.java
package pack01;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
//��õ�ǰʱ�����
public class code051
{
private String dateTime; //���ڼ�ʱ��
private String week; //����
private Calendar calendar = Calendar.getInstance(); //�����ĵ�ǰʵ��
public String getDateTime()
{
Date currentDate = Calendar.getInstance().getTime();
SimpleDateFormat format = new SimpleDateFormat("yyyy��MM��dd�� HHʱmm��ss��");
this.dateTime = format.format(currentDate);
return dateTime;
}
public String getWeek()
{
String[] weeks = new String[]{"������","����һ","���ڶ�","������","������","������","������"};
int index = calendar.get(Calendar.DAY_OF_WEEK);
this.week = weeks[index - 1];
return this.week;
}
}