Date date = new Date();
这就是系统时间,不知道搂主想怎么修改
这就是系统时间,不知道搂主想怎么修改
解决方案 »
- jsp applet问题
- 使用GridBagLayout的问题-调整组建的大小
- 无符号char型,在java 中怎么定义
- 如何把jsp中的pageContext传到javaBean中
- 急问:SWT中的StyledText,调用其append方法,为何滚动条无法定位到最近输出的那一行?
- 我的毕业设计,大家给出个主意,谢谢.
- java门外汉的几点疑问
- QQ编程的绝顶高手请指教!!!!!!!
- GridBag Layout里的GridBagConstraint的weightx,weighty的取值问题?
- 如何将几个一位数组依次赋值给一个二维数组的各行?(一位数组长度都相同)
- 怎么样重绘一个窗体?
- 定时连接oracle查找记录,但是出错!请各位高手指点,我太菜了~~:)
System.out.println("The Date is : " + date.toString());
System.out.println("The Date is : " + date.toGMTString());
System.out.println("The Date is : " + date.toLocaleString());
System.out.println("The Date is : " + date.getMonth());
System.out.println("The Year is : " + date.getYear());
Calendar calendar = Calendar.getInstance();
System.out.println("The Calendar's year is : " + calendar.get(Calendar.YEAR));
System.out.println("The Calendar's month is : " + calendar.get(Calendar.MONTH));
System.out.println("The Calendar's day of month is : " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("The Calendar's day of week is : " + calendar.get(Calendar.DAY_OF_WEEK));
建议去看看,这两个类的api 。
到 google去搜一下也有不少关于时间日期的文章。
Calendar calendar=new GregorianCalendar();
calendar.setTime(date);
String.valueOf(calendar.get(Calendar.YEAR/MONTH+1/DAY_OF_MONTH/HOUR/MINUTE))
java.util.Date datNowDate = new java.util.Date();使用SimpleDateFormat
SimpleDateFormat formatt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");使用Calender
Calender cal = Calender.getInstence();
cal.setTime(datNowDate);
cal.get(DATE_TYPE);