Java获取系统时间
2010-10-29 00:08
211 查看
/** * 获取系统时间 * @return */ public static String getDate(){ Calendar ca = Calendar.getInstance(); int year = ca.get(Calendar.YEAR); // 获取年份 int month = ca.get(Calendar.MONTH); // 获取月份 int day = ca.get(Calendar.DATE); // 获取日 int minute = ca.get(Calendar.MINUTE); // 分 int hour = ca.get(Calendar.HOUR); // 小时 int second = ca.get(Calendar.SECOND); // 秒 int millisecond = ca.get(Calendar.MILLISECOND); // 毫秒 String date = year + "/" + (month + 1 )+ "/" + day + " "+ hour + ":" + minute + ":" + second + ":" + millisecond; return date; }
相关文章推荐
- Java只获取系统时间的年份
- JAVA中获取当前系统时间
- java获取时间戳在linux系统上问题
- java中获取当前系统时间,日期并格式化输出
- JAVA中获取当前系统时间
- Java获取系统日期时间
- Java获取系统时间Timestamp类型系统时间
- Java只获取系统时间的年份
- JAVA中获取当前系统时间
- java获取本机IP 系统时间
- 一个小的知识点关于java获取系统时间的问题
- JAVA中获取当前系统时间
- JAVA中获取当前系统时间
- JAVA获取时间比系统时间少八个小时的解决办法
- java中获取当前系统时间以及过半小时之后的时间的实现
- Java获取系统当前时间不正确
- Java获取系统时间的几种方法
- JAVA获取系统时间的问题
- 解决2008系统中使用java的Date获取时间总是比实际时间差了8个小时的问题
- JAVA中获取当前系统时间