java代码051

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;
    }
}

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0