public void falsePositive() { Date today = Calendar.getInstance().getTime(); System.out.println(today); today.setDate(16); System.out.println(today); }
@Override public void setDate(int date) { checkFrozen(); super.setDate(date); }
/** * Adds the given number of days to a date. * * @param date the date * @param days number of days */ @SuppressWarnings("deprecation") // GWT requires Date public static void addDaysToDate(Date date, int days) { date.setDate(date.getDate() + days); }
/** * Sets a date object to be at the beginning of the month and no time * specified. * * @param date the date */ @SuppressWarnings("deprecation") // GWT requires Date public static void setToFirstDayOfMonth(Date date) { resetTime(date); date.setDate(1); }
/** * Constructor. */ public CalendarModel() { currentMonth = new Date(); CalendarUtil.setToFirstDayOfMonth(currentMonth); // Finding day of week names Date date = new Date(); for (int i = 1; i <= DAYS_IN_WEEK; i++) { date.setDate(i); int dayOfWeek = date.getDay(); dayOfWeekNames[dayOfWeek] = getDayOfWeekFormatter().format(date); } // Finding day of month names date.setMonth(0); for (int i = 1; i < MAX_DAYS_IN_MONTH; ++i) { date.setDate(i); dayOfMonthNames[i] = getDayOfMonthFormatter().format(date); } // finding month names date.setDate(1); for (int i = 0; i < MONTHS_IN_YEAR; ++i) { date.setMonth(i); monthOfYearNames[i] = getMonthFormatter().format(date); } }
@Test public void fromDate() { Date date = new Date(); date.setYear(0); date.setMonth(0); date.setDate(1); assertEquals(1900, new DateTime(date).getYear()); assertEquals(1, new DateTime(date).getMonth()); assertEquals(1, new DateTime(date).getDayOfMonth()); }
@Test public void fromDate() { Date date = new Date(); date.setYear(0); date.setMonth(0); date.setDate(1); assertEquals(1900, new DateTime(date).getYear()); assertEquals(1, new DateTime(date).getMonth()); assertEquals(1, new DateTime(date).getDayOfMonth()); }
@Test public void fromDate() { Date date = new Date(); date.setYear(0); date.setMonth(0); date.setDate(1); assertEquals(1900, new DateTime(date).getYear()); assertEquals(1, new DateTime(date).getMonth()); assertEquals(1, new DateTime(date).getDayOfMonth()); }
long now = System.currentTimeMillis(); System.out.println(now); //'now' being the 14th of the month Date day = new Date(); System.out.println(day); day.setDate(21); // one week later long day2 = day.getTime(); System.out.println(day2); long week = day2-now; System.out.println(week);
/** * Adds the given number of days to a date. * * @param date the date * @param days number of days */ @SuppressWarnings("deprecation") // GWT requires Date public static void addDaysToDate(Date date, int days) { date.setDate(date.getDate() + days); }
/** * Sets a date object to be at the beginning of the month and no time * specified. * * @param date the date */ @SuppressWarnings("deprecation") // GWT requires Date public static void setToFirstDayOfMonth(Date date) { resetTime(date); date.setDate(1); }
/** * Sets a date object to be at the beginning of the month and no time * specified. * * @param date the date */ @SuppressWarnings("deprecation") // GWT requires Date public static void setToFirstDayOfMonth(Date date) { resetTime(date); date.setDate(1); }
@Override public void setDate(int date) { checkFrozen(); super.setDate(date); }
@Override public void setDate(int date) { checkFrozen(); super.setDate(date); }
public static String getMonthName(int month){ Locale locale = Locale.getDefault(); SimpleDateFormat sdf = new SimpleDateFormat("MMMM",locale); Date date = new Date(); date.setDate(1); date.setMonth(month); date.setYear(2012); return sdf.format(date); }
Date date = new Date(); date.setYear(2010); date.setMonth(07); date.setDate(14) date.setHours(9); date.setMinutes(0); date.setSeconds(0); String time = new SimpleDateFormat("HH:mm:ss").format(date);
@Before public void setUp() throws Exception { Date startTime = new Date(); startTime.setYear(115); startTime.setMonth(10); startTime.setDate(10); startTime.setHours(12); startTime.setMinutes(50); startTime.setSeconds(30); TimeInstant.START_TIME = startTime; }
@Before public void setUp() throws Exception { Date startTime = new Date(); startTime.setYear(115); startTime.setMonth(10); startTime.setDate(10); startTime.setHours(12); startTime.setMinutes(50); startTime.setSeconds(30); TimeInstant.START_TIME = startTime; }
@Test public void fromDate() { Date date = new Date(); date.setYear(0); date.setMonth(0); date.setDate(1); assertEquals(1900, new DateTime(date).getYear()); assertEquals(1, new DateTime(date).getMonth()); assertEquals(1, new DateTime(date).getDayOfMonth()); }