如题 有需求如下 上传文件 文件名以当前精确到毫秒的系统时间为定 例子 20100718233524786.jpg就是在2010年07月18号23点35分24.786秒上传的文件 求高手指教
解决方案 »
- 简单日志的生成?????????????????????????????????????????????????????????
- 主机数据库连接错误
- 如何在实例销毁前执行某个方法
- 有java的练习题目吗!?!?
- JBuilder 的swing部件放哪去了?
- 代码审查问题:Denial of Service: Parse Double 如何处理
- 关于jbuilder的问题?
- 请问jbuilder中如何使用外部插件
- 使用JBUILDER做的程序如何脱离开发环境运行,有没有可执行文件?
- 微软和宝兰公司都出了JAVA,现在大家一般学那一个的??
- 请教高手Microsoft SDK for Java 4.0是干嘛的
- 有谁java牛的帮帮忙?(注意前台页面每隔2秒钟掉一次),急急,在线等待。。有案例的最好
System.nanoTime()
Calendar now=Calendar.getInstance();
int month = now.get(Calendar.MONTH) + 1;
String m = "";
if(month < 10) {
m = "0"+month;
}
String time = now.get(Calendar.YEAR)+ m + now.get(Calendar.DAY_OF_MONTH) +
now.get(Calendar.HOUR_OF_DAY)+now.get(Calendar.MINUTE)+
now.get(Calendar.SECOND)+now.get(Calendar.MILLISECOND);
System.out.println(time); }
* 获取当年时间的字符串
* @author Wang
*
*/
public class GetTime { public static void main(String[] args) {
Calendar now=Calendar.getInstance();
int month = now.get(Calendar.MONTH) + 1;
String m = "";
if(month < 10) {
m = "0"+month;
}
String time = now.get(Calendar.YEAR)+ m + now.get(Calendar.DAY_OF_MONTH) +
now.get(Calendar.HOUR_OF_DAY)+now.get(Calendar.MINUTE)+
now.get(Calendar.SECOND)+now.get(Calendar.MILLISECOND);
System.out.println(time);
System.out.println(System.currentTimeMillis());
System.out.println(System.nanoTime());
}}