58,454
社区成员
发帖
与我相关
我的任务
分享
import java.util.*;
import java.text.SimpleDateFormat;
public class HelloWorld {
public static void main(String[] args)throws Exception{
SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date endTime1=sdf1.parse("2012-05-23 12:00:00");
Date endTime2=sdf2.parse("2012-05-23 12:00:00");
// System.out.println(c.getTime());
System.out.println(endTime1);
System.out.println(endTime2);
}
}
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock.
* E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22.
*
* @see #HOUR
*/
public final static int HOUR_OF_DAY = 11;