String toLocaleString() Deprecated. As of JDK version 1.1, replaced by DateFormat.format(Date date). 这个是java的API,因为data.toLocaleString()已经被其他的改写了,通常情况下是不用这个的。 应该用DataFormat dformat = new DataFormat(); str = dformat.format(data); 记得要捕获异常呀。
Calendar cal = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); String mDateTime=formatter.format(cal.getTime());String filePath=mDateTime+".txt"; File myFilePath=new File(filePath); if(!myFilePath.exists()) myFilePath.createNewFile();
Deprecated. As of JDK version 1.1, replaced by DateFormat.format(Date date).
这个是java的API,因为data.toLocaleString()已经被其他的改写了,通常情况下是不用这个的。
应该用DataFormat dformat = new DataFormat();
str = dformat.format(data);
记得要捕获异常呀。
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String mDateTime=formatter.format(cal.getTime());String filePath=mDateTime+".txt";
File myFilePath=new File(filePath);
if(!myFilePath.exists())
myFilePath.createNewFile();