获取当天截止时刻 踩坑

/**
 * Field number for <code>get</code> and <code>set</code> indicating the
 * hour of the morning or afternoon. <code>HOUR</code> is used for the
 * 12-hour clock (0 - 11). Noon and midnight are represented by 0, not by 12.
 * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10.
 *
 * @see #AM_PM
 * @see #HOUR_OF_DAY
 */
public final static int HOUR = 10;

/**
 * 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;

    /**
    * 当天的结束时间
    * 单位秒
    * @return
    */
   public static Integer getTodayEndTime() {
       Calendar todayEnd = Calendar.getInstance();

//    todayEnd.set(Calendar.HOUR, 23);
      todayEnd.set(Calendar.HOUR_OF_DAY, 23); 

      todayEnd.set(Calendar.MINUTE, 59);

      todayEnd.set(Calendar.SECOND, 59);

      todayEnd.set(Calendar.MILLISECOND, 999);

      return Convert.toInt(todayEnd.getTime().getTime()/1000);

   }

版权声明:本文为Yuli_li原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。