import java.sql.*;
Timestamp currentTime=new Timestamp(System.currentTimeMillis());
获取当前时间
currentTime=Timestamp.valueOf(lastAccessDatetime);
把上次记录的时间调出来(一般是字符格式)
好像还有java.util.date,不过不好用
Timestamp currentTime=new Timestamp(System.currentTimeMillis());
获取当前时间
currentTime=Timestamp.valueOf(lastAccessDatetime);
把上次记录的时间调出来(一般是字符格式)
好像还有java.util.date,不过不好用
{
Date today = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd G 'at' hh:mm:ss z");
try
{
String dateString = formatter.format(today);
return dateString;
} catch (IllegalArgumentException iae) {
result.setForeground(Color.red);
result.setText("Error: " + iae.getMessage());
}
}