格林威治时间转时间戳

261 阅读1分钟
示例:Jul 24, 2019 3:00:46 PM
示例代码:
String str="Jul 24, 2019 3:00:46 PM";
SimpleDateFormat format=new SimpleDateFormat("MMM dd, yyyy hh:mm:ss aa", Locale.ENGLISH);
try {
    System.out.println(format.format(new Date()));
    System.out.println(format.format(format.parse(str)));
} catch (Exception e) {
    e.printStackTrace();
}