java关于时间处理的函数

import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class Dateutil {

private SimpleDateFormat sdf=null;
private String getDate(){
    this.sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:SS.sss");
    return this.sdf.format(new Date());
}
//生成时间格式2017-07-23 09:06:988.049
private String getDateCoplete(){
    this.sdf=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分SS秒sss毫秒");
    return this.sdf.format(new Date());
}
//生成时间格式2017年07月23日 09时06分988秒049毫秒
private String getDateCopletes(){
    this.sdf=new SimpleDateFormat("yyyyMMddHHmSSsss");
    return this.sdf.format(new Date());
}
//生成时间格式20170723096988049

}

猜你喜欢

转载自blog.csdn.net/yishuihanxun/article/details/75815802