Java Date 和 Calendar 实例
Java 之 Date 和 Calendar 实例
运行结果:
当前日期:
2012-03-07
2012-03-07 12:30:11
2012-3-7 12:30:11.101
计算周:
-3
3/5/12 12:30 PM
3/10/12 12:30 PM
3/12/12 12:30 PM
3/3/12 12:30 PM
计算月:
2012-03-01
2012-03-31
2012-02-01
2012-02-29
2012-04-01
2012-04-30
计算年:
2012-01-01
2012-12-31
2011-01-01
2011-12-31
2013-01-01
2013-12-31
366 in 2012
计算季度:
2012-3-7 in [ 2012-1 : 2012-3 ]
31 in [ 2012-3-7 ]
true
日期格式转换与计算:
Wed Jun 20 00:00:00 CST 2012
Wednesday
2012-06-02 -> 2012-06-12间隔天数:10