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;
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册⭐️ Admin快速开发: https://show.cool-admin.com/
赞 0⭐️ 官方文档: https://cool-js.com
赞 0⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld
赞 0