Timestamp urlTime = getCxtDate();为何返回不来值?//MyService.getCxtDate()
public static Timestamp getCxtDate(){
Timestamp dateStr = java.sql.Timestamp.valueOf(Util.getCxnDate());
return dateStr;
}
//Util.getCxtDate()
public static String getCxnDate(){[code=java]
Date now = new Date();
DateFormat date = DateFormate.getDateTimeInstance();
String currentDate = date.format(now);
return currentDate;}
[/code]TimestampJ2SEStringJava
/**
* 获取显示时间(格式为:年月日时分秒)
*
* @param time 指定时间
* @return 标准时间
*/
public static String getDisplayTime(Timestamp time) {
// 判断空
if (time == null) {
return null;
} // 转化时间
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(time);
}