Package org.jquantlib.time

Examples of org.jquantlib.time.Date.dayOfMonth()


    @Test
    public void isoDates() {
        QL.info("Testing ISO dates...");
        final String input_date = "2006-01-15";
        final Date d = DateParser.parseISO(input_date);
        if ((d.dayOfMonth() != 15) || (d.month() != Month.January) || (d.year() != 2006)) {
            fail("Iso date failed\n"
                    + " input date:    " + input_date + "\n"
                    + " day of month:  " + d.dayOfMonth() + "\n"
                    + " month:         " + d.month() + "\n"
                    + " year:          " + d.year());
View Full Code Here


        final String input_date = "2006-01-15";
        final Date d = DateParser.parseISO(input_date);
        if ((d.dayOfMonth() != 15) || (d.month() != Month.January) || (d.year() != 2006)) {
            fail("Iso date failed\n"
                    + " input date:    " + input_date + "\n"
                    + " day of month:  " + d.dayOfMonth() + "\n"
                    + " month:         " + d.month() + "\n"
                    + " year:          " + d.year());
        }
    }
View Full Code Here

            Date newD2 = dateEnd;
            Date temp = dateEnd;
            double sum = 0.0;
            while (temp.gt(dateStart)) {
                temp = newD2.add(Period.ONE_YEAR_BACKWARD);
                if (temp.dayOfMonth() == 28 && temp.month().value() == 2 && Date.isLeap(temp.year()))
                    temp.inc();
                if (temp.ge(dateStart)) {
                    sum += 1.0;
                    newD2 = temp;
                }
View Full Code Here

            Date newD2 = dateEnd;
            Date temp = dateEnd;
            double sum = 0.0;
            while (temp.gt(dateStart)) {
                temp = newD2.add(Period.ONE_YEAR_BACKWARD);
                if (temp.dayOfMonth() == 28 && temp.month().value() == 2 && Date.isLeap(temp.year()))
                    temp.inc();
                if (temp.ge(dateStart)) {
                    sum += 1.0;
                    newD2 = temp;
                }
View Full Code Here

        //Get the weekday
        final Weekday weekDayOfThisDate = today.weekday();
        System.out.println("The weekday of this date is = "+weekDayOfThisDate);

        //Get the day of the date for it's month
        System.out.println("The day of the date as a day in this date's month(1-31) is = "+today.dayOfMonth());

        //Get the day of the date for it's year
        System.out.println("The day of the date as day in it's year(1-366) is = "+today.dayOfYear());

        //Check if the date belongs to a leap year
View Full Code Here

        final Date fourthWeekdayDate = Date.nthWeekday(4, Weekday.Tuesday, today.month(), today.year());
        System.out.println("The fourthWeekdayDate which is TUESDAY is = "+fourthWeekdayDate);

        //Let's try getting the first date of the month to which today's date belong to
        final Date dateEndOfMonth = Date.endOfMonth(today);
        final int dayOfEndOfMonth = dateEndOfMonth.dayOfMonth();
        final Date dateStartOfMonth = dateEndOfMonth.add(-dayOfEndOfMonth+1);
        System.out.println("The first date of the month to which todays date belong to is = "+dateStartOfMonth);

        //Let's try getting the first date of the month to which today's date belong to using Period
        final Period period = new Period(-today.dayOfMonth()+1,TimeUnit.Days);
View Full Code Here

    @Test
    public void isoDates() {
        QL.info("Testing ISO dates...");
        final String input_date = "2006-01-15";
        final Date d = DateParser.parseISO(input_date);
        if ((d.dayOfMonth() != 15) || (d.month() != Month.January) || (d.year() != 2006)) {
            fail("Iso date failed\n"
                    + " input date:    " + input_date + "\n"
                    + " day of month:  " + d.dayOfMonth() + "\n"
                    + " month:         " + d.month() + "\n"
                    + " year:          " + d.year());
View Full Code Here

        final String input_date = "2006-01-15";
        final Date d = DateParser.parseISO(input_date);
        if ((d.dayOfMonth() != 15) || (d.month() != Month.January) || (d.year() != 2006)) {
            fail("Iso date failed\n"
                    + " input date:    " + input_date + "\n"
                    + " day of month:  " + d.dayOfMonth() + "\n"
                    + " month:         " + d.month() + "\n"
                    + " year:          " + d.year());
        }
    }
View Full Code Here

          // compare d,m,y
            boolean test = true;
            test &= ( jqlDate.year()          == jyear );
            test &= ( jqlDate.month().value() == jmonth + 1); //Java month is 0-11
            test &= ( jqlDate.dayOfMonth()    == jday );
            success &= test;

            if (!test) {
                QL.info(String.format("JQL Date = %s   :::   ISODate = %s", jqlDate.toString(), javaDate.toString()));
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.