如题
解决方案 »
- Java打JAR时遇到的传路径问题
- 求一java获取网页信息
- java练习题
- 如何判断java程序是否在windows下运行
- 输入输出简单问题请求大家的答案...
- 请问如何给显示的图像以及图像之间的连线分别添加事件处理
- 怎么将Date类型的日期转换成另一种Date类型的日期格式?多多指教
- ----如何将子frame中的文本添加到父frame中的JTextPane中-----
- 有几个在HttpSession包中的类的作用,想请教?
- Juilder6注册!将license key粘贴以后,它不停的让你重新选择have serial number和license key!
- 关于日期计算...
- 请YuLimin(阿敏总司令:简单就是美)进来接分(3)
String str = sdf1.format(iDate);
Date date = c.getTime() ;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(date));
Date currentDate;
String now;
formatter = new SimpleDateFormat("yyyy/MM/dd/ HH:mm:ss", Locale
.getDefault());
currentDate = new Date();
now = formatter.format(currentDate);
return now;
}
sb.append(c.get(Calendar.YEAR));
sb.append("-");
sb.append(c.get(Calendar.MONTH));
sb.append("-");
sb.append(c.get(Calendar.DAY_OF_MONTH));
sb.append(" ");自己去完成吧
注意十位补零
import java.text.*;
public class Time{
public static void main(String[] args){
Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = "";
s = sdf.format(now.getTime());
System.out.println(s);
}
}