Пример #1
0
  public static void main(String[] args) {

    System.out.println("dttime===" + RealTime.getNowDate());
    System.out.println(strGetTimeToHour());

    System.out.println(getHourByTime(System.currentTimeMillis()));
  }
Пример #2
0
 // 得到程序中标准时间到天
 public static String strGetTimeToDay() {
   String dttime = null;
   Calendar temptime = RealTime.calGetCalendarTime();
   dttime = String.valueOf(temptime.get(Calendar.YEAR));
   dttime += "-" + LenMore1(String.valueOf(temptime.get(Calendar.MONTH) + 1));
   dttime += "-" + LenMore1(String.valueOf(temptime.get(Calendar.DAY_OF_MONTH)));
   return dttime;
 }
Пример #3
0
 // 得到程序中标准时间到月
 public static String strGetTimeToMonth() {
   /** 生成时间类型如:2005年3月 */
   String dttime = null;
   Calendar temptime = RealTime.calGetCalendarTime();
   dttime = String.valueOf(temptime.get(Calendar.YEAR)) + "年";
   dttime += String.valueOf(temptime.get(Calendar.MONTH) + 1) + "月";
   return dttime;
 }
Пример #4
0
 // 得到程序中标准时间到分
 public static String strGetTimeToMinute() {
   String dttime = null;
   Calendar temptime = RealTime.calGetCalendarTime();
   dttime = String.valueOf(temptime.get(Calendar.YEAR));
   dttime += "年" + LenMore1(String.valueOf(temptime.get(Calendar.MONTH) + 1));
   dttime += "月" + LenMore1(String.valueOf(temptime.get(Calendar.DAY_OF_MONTH)));
   dttime += "日 " + LenMore1(String.valueOf(temptime.get(Calendar.HOUR_OF_DAY)));
   dttime += ":" + LenMore1(String.valueOf(temptime.get(Calendar.MINUTE)));
   return dttime;
 }
Пример #5
0
 // 得到程序中标准的全显示时间
 public static String strGetAllTimeToSecond() {
   String dttime = null;
   Calendar temptime = RealTime.calGetCalendarTime();
   dttime = String.valueOf(temptime.get(Calendar.YEAR));
   dttime += "-" + LenMore1(String.valueOf(temptime.get(Calendar.MONTH) + 1));
   dttime += "-" + LenMore1(String.valueOf(temptime.get(Calendar.DAY_OF_MONTH)));
   dttime += " " + LenMore1(String.valueOf(temptime.get(Calendar.HOUR_OF_DAY)));
   dttime += ":" + LenMore1(String.valueOf(temptime.get(Calendar.MINUTE)));
   dttime += ":" + LenMore1(String.valueOf(temptime.get(Calendar.SECOND)));
   return dttime;
 }