日期转换为Long类型问题

"Jan 30, 2014 12:00:00 AM"转换为Long类型

用DateTime.ParseExact转换成日期类型,至于你说的long,有好几种,搞清楚是哪一种,是不是unix时间戳还是什么。

java实现方式如下,祝好!

 DateFormat format = new SimpleDateFormat();
        Date date;
        try {
            date = format.parse("Jan 30, 2014 12:00:00 AM");
            long time = date.getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
 public String getYMDHMSTime(long millisecondtime, String pattern){
     Date date = new Date(millisecondtime);        
     SimpleDateFormat format = new SimpleDateFormat();
     format.applyPattern(pattern);
     String strDate = format.format(date);                      
     return strDate;
 }
public long getMillisecondTime(String time, String pattern) throws Exception{
    SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.SIMPLIFIED_CHINESE);
    Date date = sdf.parse(time);              
    return date.getTime();        
 }

SimpleDateFormat formatter = new SimpleDateFormat("MMM dd,yyyy hh:mm:ss aa",Locale.US);
try {
Date date = formatter.parse("Jan 30,2014 12:00:00 AM");
System.out.println(date.getTime());
}catch(Exception ex){
System.out.println("Failed.");
}
Date curr = new Date();
System.out.println(formatter.format(curr));