List of usage examples for java.util Calendar AUGUST
int AUGUST
To view the source code for java.util Calendar AUGUST.
Click Source Link
From source file:Negocio.Produccion.Planificacion.GanttDemo.java
/** * Creates a sample dataset for a Gantt chart. * * @return The dataset./*from w w w . j a v a2 s. c o m*/ */ public static IntervalCategoryDataset createDataset() { final TaskSeries s1 = new TaskSeries("Scheduled"); s1.add(new Task("Write Proposal", new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001)))); s1.add(new Task("Obtain Approval", new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001)))); s1.add(new Task("Requirements Analysis", new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001)))); s1.add(new Task("Design Phase", new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001)))); s1.add(new Task("Design Signoff", new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001)))); s1.add(new Task("Alpha Implementation", new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001)))); s1.add(new Task("Design Review", new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001)))); s1.add(new Task("Revised Design Signoff", new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001)))); s1.add(new Task("Beta Implementation", new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001)))); s1.add(new Task("Testing", new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001)))); s1.add(new Task("Final Implementation", new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001)))); s1.add(new Task("Signoff", new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001)))); final TaskSeries s2 = new TaskSeries("Actual"); s2.add(new Task("Write Proposal", new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001)))); s2.add(new Task("Obtain Approval", new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001)))); s2.add(new Task("Requirements Analysis", new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001)))); s2.add(new Task("Design Phase", new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001)))); s2.add(new Task("Design Signoff", new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001)))); s2.add(new Task("Alpha Implementation", new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Design Review", new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Revised Design Signoff", new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Beta Implementation", new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001)))); s2.add(new Task("Testing", new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001)))); s2.add(new Task("Final Implementation", new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001)))); s2.add(new Task("Signoff", new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001)))); final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); collection.add(s2); return collection; }
From source file:com.espertech.esper.regression.pattern.TestCronParameter.java
public void testOperator() throws Exception { // Observer for last Sunday of month, 0 = Sunday int lastDayOfWeek = getLastDayOfWeekInMonth(0, 2007); calendar.set(2007, getCurrentMonth(2007), lastDayOfWeek, 8, 00, 00); printCurrentTime(calendar);/*from w w w.j av a2s . c o m*/ baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, *, 0 last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of current month calendar.set(2007, getCurrentMonth(2007), getLastDayOfMonth(2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, last, *, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of Auguts 2007 // For Java: January=0, February=1, March=2, April=3, May=4, June=5, // July=6, August=7, September=8, November=9, October=10, December=11 // For Esper: January=1, February=2, March=3, April=4, May=5, June=6, // July=7, August=8, September=9, November=10, October=11, December=12 calendar.set(2007, Calendar.AUGUST, 31, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, last, 8, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of February 2007 calendar.set(2007, Calendar.FEBRUARY, 28, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, last, 2, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last day of week (Saturday) Calendar calendar = Calendar.getInstance(); Date date = new Date(); calendar.setTime(date); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, *, last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last Friday of June calendar.set(2007, Calendar.JUNE, 29, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, 6, 5 last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last weekday of the current month calendar.set(2007, getCurrentMonth(2007), getLastWeekDayOfMonth(null, 2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, lastweekday, *, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last weekday of September 2007, it's Friday September 28th calendar.set(2007, Calendar.SEPTEMBER, 28, 10, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, lastweekday, 9, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last weekday of February, it's Wednesday February 28th calendar.set(2007, Calendar.FEBRUARY, 28, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, lastweekday, 2, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for nearest weekday for current month on the 10th calendar.set(2007, getCurrentMonth(2007), getLastWeekDayOfMonth(10, 2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, 10 weekday, *, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for nearest weekday of September 1st (Saturday), it's Monday September 3rd (no "jump" over month) calendar.set(2007, Calendar.SEPTEMBER, 3, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, 1 weekday, 9, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for nearest weekday of September 30th (Sunday), it's Friday September 28th (no "jump" over month) calendar.set(2007, Calendar.SEPTEMBER, 28, 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, 30 weekday, 9, *, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); // Observer for last Friday of current month, // 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4= Thursday, 5=Friday, 6=Saturday calendar.set(2007, getCurrentMonth(2007), getLastDayOfWeekInMonth(5, 2007), 8, 00, 00); printCurrentTime(calendar); baseTime = calendar.getTimeInMillis(); testData = getEventSet(baseTime, 1000 * 60 * 10); expressionText = "timer:at(*, *, *, *, 5 last, *)"; testCase = new EventExpressionCase(expressionText); testCase.add("A1"); runTestEvent(); }
From source file:ch.puzzle.itc.mobiliar.business.generator.control.extracted.ResourceDependencyResolverServiceTest.java
@Test public void testFindNearestRelease() { // given//from w w w. ja v a 2 s . c o m Calendar cal = new GregorianCalendar(); cal.set(2001, Calendar.JANUARY, 1); ReleaseEntity release1 = createRelease(1, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.JANUARY, 1); ReleaseEntity release2 = createRelease(2, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.JANUARY, 23); ReleaseEntity release3 = createRelease(3, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.AUGUST, 8); ReleaseEntity release4 = createRelease(4, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.DECEMBER, 31); ReleaseEntity release5 = createRelease(5, new Date(cal.getTimeInMillis())); cal.set(2014, Calendar.NOVEMBER, 10); ReleaseEntity release6 = createRelease(6, new Date(cal.getTimeInMillis())); SortedSet<ReleaseEntity> releases = new TreeSet<ReleaseEntity>(); // when only past release exists releases.add(release1); cal.set(2013, Calendar.JANUARY, 10); ReleaseEntity nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then assertEquals(release1.getId(), nearestRelease.getId()); // when there are multiple past releases releases.add(release2); releases.add(release3); cal.set(2013, Calendar.FEBRUARY, 10); nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then assertEquals(release3.getId(), nearestRelease.getId()); // when there is one future release releases.add(release4); cal.set(2013, Calendar.FEBRUARY, 10); nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then assertEquals(release4.getId(), nearestRelease.getId()); // when there are multiple future releases cal.set(2013, Calendar.AUGUST, 9); releases.add(release5); releases.add(release6); nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then Assert.assertEquals(release5.getId(), nearestRelease.getId()); }
From source file:com.mycompany.CRMFly.serviceLayer.ProductsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Products product) { Long id = product.getId();/* w w w.j a v a 2s . c o m*/ Calendar calendar = new GregorianCalendar(); Integer monthDifference = 0; if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL || calendar.get(Calendar.MONTH) == Calendar.JULY || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) { monthDifference = 0; } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY || calendar.get(Calendar.MONTH) == Calendar.AUGUST || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) { monthDifference = -1; } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER || calendar.get(Calendar.MONTH) == Calendar.DECEMBER) monthDifference = -2; Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH); calendar.add(Calendar.MONTH, monthDifference); calendar.add(Calendar.DAY_OF_MONTH, dayDifference - 1); Date beginningOfQuarter = calendar.getTime(); Double thisQuarterSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackOne = calendar.getTime(); Double QuarterBackOneSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackTwo = calendar.getTime(); Double QuarterBackTwoSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackThree = calendar.getTime(); Double QuarterBackThreeSum = 0.0; List<PositionsInContract> positions = productsDAO.getContractPositionsForProduct(id); HashMap<Date, Double> sums = new HashMap<Date, Double>(); for (PositionsInContract position : positions) { Long posID = position.getId(); Contracts contract = productsDAO.getContractForPosition(posID); Date date = contract.getBegin_date(); if (date.after(beginningOfQuarter)) thisQuarterSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackOne)) QuarterBackOneSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackTwo)) QuarterBackTwoSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackThree)) QuarterBackThreeSum += position.getPrice() * position.getQuantity(); } sums.put(beginningOfQuarter, thisQuarterSum); sums.put(QuarterBackOne, QuarterBackOneSum); sums.put(QuarterBackTwo, QuarterBackTwoSum); sums.put(QuarterBackThree, QuarterBackThreeSum); return sums; }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting short description of month by the number * of month//from ww w . j av a 2s .com * * @param mthNum * @return */ public static String getMonthShortDesc(int mthNum) { String mthShortDesc; switch (mthNum) { case Calendar.JANUARY: { mthShortDesc = DateTimeConstants.SHORT_JANUARY; break; } case Calendar.FEBRUARY: { mthShortDesc = DateTimeConstants.SHORT_FEBRUARY; break; } case Calendar.MARCH: { mthShortDesc = DateTimeConstants.SHORT_MARCH; break; } case Calendar.APRIL: { mthShortDesc = DateTimeConstants.SHORT_APRIL; break; } case Calendar.MAY: { mthShortDesc = DateTimeConstants.SHORT_MAY; break; } case Calendar.JUNE: { mthShortDesc = DateTimeConstants.SHORT_JUNE; break; } case Calendar.JULY: { mthShortDesc = DateTimeConstants.SHORT_JULY; break; } case Calendar.AUGUST: { mthShortDesc = DateTimeConstants.SHORT_AUGUST; break; } case Calendar.SEPTEMBER: { mthShortDesc = DateTimeConstants.SHORT_SEPTEMBER; break; } case Calendar.OCTOBER: { mthShortDesc = DateTimeConstants.SHORT_OCTOBER; break; } case Calendar.NOVEMBER: { mthShortDesc = DateTimeConstants.SHORT_NOVEMBER; break; } case Calendar.DECEMBER: { mthShortDesc = DateTimeConstants.SHORT_DECEMBER; break; } default: { mthShortDesc = ""; break; } } return mthShortDesc; }
From source file:moviemanager.backend.PersonManagerTest.java
/** * Unit test for updating person.// w w w . j av a 2s.c om */ @Test public void testUpdatePerson() { log.info("Testing updating person..."); String newName = "James Tiberius Kirk (Update)"; String personName = "James T. Kirk (Update)"; Calendar calendar = new GregorianCalendar(1956, Calendar.AUGUST, 19); Calendar updatedCalendar = new GregorianCalendar(1955, Calendar.SEPTEMBER, 19); Person person = new Person(personName, calendar); Person updatedPerson = new Person(newName, updatedCalendar); personManager.createPerson(person); Long id = person.getId(); Person res = personManager.getPerson(id); res.setName(newName); res.setBirth(calendar); res.setId(person.getId()); personManager.updatePerson(res); assertEquals(newName, res.getName()); assertEquals(res.getBirth(), person.getBirth()); res.setBirth(updatedCalendar); assertTrue(res.getBirth() != person.getBirth()); assertEquals(res.getBirth(), updatedCalendar); }
From source file:ca.uhn.hl7v2.model.primitive.CommonTSTest.java
/** * See bug 3545328// w w w . j av a2 s . com * * This bug has not yet been evaluated, so the test will fail. */ @Test public void testOffsetProblem() throws HL7Exception { GregorianCalendar hapiTestCalendar = (GregorianCalendar) GregorianCalendar .getInstance(TimeZone.getTimeZone("CET")); hapiTestCalendar.set(2012, Calendar.FEBRUARY, 1); hapiTestCalendar = (GregorianCalendar) DateUtils.truncate(hapiTestCalendar, Calendar.DATE); assertEquals("20120201000000+0100", CommonTS.toHl7TSFormat(hapiTestCalendar)); hapiTestCalendar.set(2012, Calendar.AUGUST, 1); assertEquals("20120801000000+0200", CommonTS.toHl7TSFormat(hapiTestCalendar)); }
From source file:net.audumla.astronomy.algorithims.AstronomicalTest.java
@Test public void testWrapperMethodsMelbourne() throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("Australia/Melbourne")); CelestialObject sun = CelestialObject.SUN; Calendar c = Calendar.getInstance(TimeZone.getDefault()); c.setTimeInMillis(0);/*from www. j a v a 2 s.c o m*/ c.set(Calendar.YEAR, 2009); c.set(Calendar.MONTH, Calendar.AUGUST); c.set(Calendar.DAY_OF_MONTH, 8); Date date = c.getTime(); Geolocation.Location location = new Geolocation.Location(-37.70461920, 145.1030275, 0.0); TransitDetails details = sun.getTransitDetails(date, location, Sun.CIVIL); logger.debug("Melbourne"); logger.debug("Date : " + date); logger.debug("Julian : " + new JulianDate(date).julian()); logger.debug("Sunrise : Algorithms: " + details.getRiseTime() + " : " + details.getRiseTime().getTime()); logger.debug("Sunset : Algorithms: " + details.getSetTime() + " : " + details.getSetTime().getTime()); Assert.assertEquals(details.getRiseTime().getTime(), 1249677914422l, 1000); Assert.assertEquals(details.getSetTime().getTime(), 1249718740422l, 1000); }
From source file:org.sakaiproject.util.CalendarUtil.java
void initDates() { Calendar calendarSunday = Calendar.getInstance(); Calendar calendarMonday = Calendar.getInstance(); Calendar calendarTuesday = Calendar.getInstance(); Calendar calendarWednesday = Calendar.getInstance(); Calendar calendarThursday = Calendar.getInstance(); Calendar calendarFriday = Calendar.getInstance(); Calendar calendarSaturday = Calendar.getInstance(); calendarSunday.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); calendarMonday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendarTuesday.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendarWednesday.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); calendarThursday.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); calendarFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); calendarSaturday.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); dateSunday = calendarSunday.getTime(); dateMonday = calendarMonday.getTime(); dateTuesday = calendarTuesday.getTime(); dateWednesday = calendarWednesday.getTime(); dateThursday = calendarThursday.getTime(); dateFriday = calendarFriday.getTime(); dateSaturday = calendarSaturday.getTime(); Calendar calendarJanuary = Calendar.getInstance(); Calendar calendarFebruary = Calendar.getInstance(); Calendar calendarMarch = Calendar.getInstance(); Calendar calendarApril = Calendar.getInstance(); Calendar calendarMay = Calendar.getInstance(); Calendar calendarJune = Calendar.getInstance(); Calendar calendarJuly = Calendar.getInstance(); Calendar calendarAugust = Calendar.getInstance(); Calendar calendarSeptember = Calendar.getInstance(); Calendar calendarOctober = Calendar.getInstance(); Calendar calendarNovember = Calendar.getInstance(); Calendar calendarDecember = Calendar.getInstance(); calendarJanuary.set(Calendar.MONTH, Calendar.JANUARY); calendarFebruary.set(Calendar.MONTH, Calendar.FEBRUARY); calendarMarch.set(Calendar.MONTH, Calendar.MARCH); calendarApril.set(Calendar.MONTH, Calendar.APRIL); calendarMay.set(Calendar.MONTH, Calendar.MAY); calendarJune.set(Calendar.MONTH, Calendar.JUNE); calendarJuly.set(Calendar.MONTH, Calendar.JULY); calendarAugust.set(Calendar.MONTH, Calendar.AUGUST); calendarSeptember.set(Calendar.MONTH, Calendar.SEPTEMBER); calendarOctober.set(Calendar.MONTH, Calendar.OCTOBER); calendarNovember.set(Calendar.MONTH, Calendar.NOVEMBER); calendarDecember.set(Calendar.MONTH, Calendar.DECEMBER); dateJanuary = calendarJanuary.getTime(); dateFebruary = calendarFebruary.getTime(); dateMarch = calendarMarch.getTime(); dateApril = calendarApril.getTime(); dateMay = calendarMay.getTime();//from w ww . j a v a2 s . c o m dateJune = calendarJune.getTime(); dateJuly = calendarJuly.getTime(); dateAugust = calendarAugust.getTime(); dateSeptember = calendarSeptember.getTime(); dateOctober = calendarOctober.getTime(); dateNovember = calendarNovember.getTime(); dateDecember = calendarDecember.getTime(); }
From source file:net.audumla.astronomy.algorithims.AstronomicalTest.java
@Test public void testWrapperMethodsMexico() throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("America/Mexico_City")); CelestialObject sun = new Sun(); Calendar c = Calendar.getInstance(TimeZone.getDefault()); c.setTimeInMillis(0);/*from www. j a va 2 s .c o m*/ c.set(Calendar.YEAR, 2009); c.set(Calendar.MONTH, Calendar.AUGUST); c.set(Calendar.DAY_OF_MONTH, 8); Date date = c.getTime(); Geolocation.Location location = new Geolocation.Location(); location.setLatitude(19.4328, Geolocation.Direction.NORTH); location.setLongitude(99.1333, Geolocation.Direction.WEST); TransitDetails details = sun.getTransitDetails(date, location, Sun.CIVIL); logger.debug("Mexico"); logger.debug("Date : " + date); logger.debug("Julian : " + new JulianDate(date).julian()); logger.debug("Sunrise : Algorithms: " + details.getRiseTime() + " : " + details.getRiseTime().getTime()); logger.debug("Sunset : Algorithms: " + details.getSetTime() + " : " + details.getSetTime().getTime()); Assert.assertEquals(details.getRiseTime().getTime(), 1249732325341l, 1000); Assert.assertEquals(details.getSetTime().getTime(), 1249781509341l, 1000); }