比如把String类型“201104141302” 转换成毫秒数?不胜感激!
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); }}
时间: 2024-10-06 17:00:03