List of usage examples for java.util Calendar MILLISECOND
int MILLISECOND
To view the source code for java.util Calendar MILLISECOND.
Click Source Link
get
and set
indicating the millisecond within the second. From source file:Main.java
/** * Convert the day in calendar in the end of the day: 23:59:59.999 * @param c Calendar to change/* w w w . j ava2 s .com*/ */ public static void endOfDay(Calendar c) { c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); c.set(Calendar.MILLISECOND, 999); }
From source file:Main.java
public static long getYearMonthDay(long date) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(date);/* w w w .j a v a 2 s .co m*/ calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTimeInMillis(); }
From source file:Main.java
/** * @return Return current day timestamp with YY, MM, dd info ONLY */// ww w. j a v a 2 s . c o m public static Long getCurrentDayTS() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
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);/*from w w w. j ava 2s .c om*/ cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
From source file:Main.java
public static Date getTheEndOfDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w ww.j a v a 2 s. c o m calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); return calendar.getTime(); }
From source file:Main.java
public static Long getToday() { Calendar today = Calendar.getInstance(); today.setTimeZone(TimeZone.getDefault()); today.set(Calendar.SECOND, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.HOUR_OF_DAY, 1); today.set(Calendar.MILLISECOND, 0); // FOR DEBUG/*from w ww. j av a 2 s .co m*/ //today.set(Calendar.DAY_OF_YEAR, today.get(Calendar.DAY_OF_YEAR) + 1); return today.getTimeInMillis(); }
From source file:Main.java
public static Date getTheBeginingOfDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*ww w . ja va 2s . c om*/ 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 void setDateTime(long timeStamp, Calendar currentCalender, int i) { currentCalender.setTimeInMillis(timeStamp); currentCalender.set(Calendar.DATE, 1); currentCalender.set(Calendar.HOUR_OF_DAY, 0); currentCalender.set(Calendar.MINUTE, 0); currentCalender.set(Calendar.SECOND, 0); currentCalender.set(Calendar.MILLISECOND, 0); currentCalender.add(Calendar.DATE, i); }
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; }