List of usage examples for java.util Calendar MINUTE
int MINUTE
To view the source code for java.util Calendar MINUTE.
Click Source Link
get
and set
indicating the minute within the hour. From source file:Main.java
public static String updateCalendarTimeAndGetFormat(Calendar cal, int hourOfDay, int minute) { cal.set(Calendar.HOUR_OF_DAY, hourOfDay); cal.set(Calendar.MINUTE, minute); return defaultTimeFormat.format(cal.getTime()); }
From source file:Main.java
public static Date getTheBeginingOfDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);// ww w .java2 s. co m calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }
From source file:Main.java
public static Calendar GetThisYearLeftRange(Calendar today) { Calendar calendar = (Calendar) today.clone(); calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 0); return calendar; }
From source file:Main.java
public static long getTimeStampStartOfDay(long time) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.setTime(new Date(time)); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0);//ww w . j av a2s . co m cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static Calendar GetLastYearRightRange(Calendar today) { Calendar calendar = (Calendar) today.clone(); calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 0); return calendar; }
From source file:Main.java
public static final long getValidTime(TimePicker timePicker) { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour().intValue()); c.set(Calendar.MINUTE, timePicker.getCurrentMinute().intValue()); return c.getTimeInMillis(); }
From source file:Main.java
public static Date hourRoundPlusHour(Date date, int n) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w ww . java 2 s . c o m calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); calendar.add(Calendar.HOUR_OF_DAY, n); return calendar.getTime(); }
From source file:Main.java
public static final String getStandardTime(int minute, int hour) { SimpleDateFormat format = new SimpleDateFormat("HH:mm", Locale.CHINA); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.HOUR_OF_DAY, hour); return format.format(calendar.getTime()); }
From source file:Main.java
public static String getTime() { StringBuffer sb = new StringBuffer(); Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); int hour = c.get(Calendar.HOUR_OF_DAY); int minutes = c.get(Calendar.MINUTE); if (hour < 10) { sb.append(0);/*from www .j a v a2 s. co m*/ sb.append(hour); } else { sb.append(hour); } sb.append(':'); if (minutes < 10) { sb.append(0); sb.append(minutes); } else { sb.append(minutes); } return sb.toString(); }
From source file:Main.java
public static String getDate(int hour, int min) { Date d = new Date(); Calendar now = Calendar.getInstance(); now.setTime(d);/* w ww . ja va2 s . com*/ now.set(Calendar.HOUR, now.get(Calendar.HOUR) + hour); now.set(Calendar.MINUTE, now.get(Calendar.MINUTE) + min); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH/mm"); return sdf.format(now.getTime()); }