java怎么把时间转化为毫秒值
1个回答
展开全部
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class Cat {
public static void main(String[] args) throws ParseException {
String str = "201104141302";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmm");
long millionSeconds = sdf.parse(str).getTime();//毫秒
System.out.println(millionSeconds);
}
}
输出结果就是:1302757320000
import java.text.SimpleDateFormat;
public class Cat {
public static void main(String[] args) throws ParseException {
String str = "201104141302";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmm");
long millionSeconds = sdf.parse(str).getTime();//毫秒
System.out.println(millionSeconds);
}
}
输出结果就是:1302757320000
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询