Example usage for org.joda.time DateTime getDayOfMonth

List of usage examples for org.joda.time DateTime getDayOfMonth

Introduction

In this page you can find the example usage for org.joda.time DateTime getDayOfMonth.

Prototype

public int getDayOfMonth() 

Source Link

Document

Get the day of month field value.

Usage

From source file:com.toedter.jcalendar.core.DateChooser.java

License:Open Source License

/**
 * Constructs an instance from a given DateTime.
 * //www . ja  v  a  2s  .c o  m
 * @param calendar
 *            the initializing DateTime
 */
public DateChooser(DateTime dateTime) {
    // normalize to year/month/date only
    this.dateTime = new DateTime(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), 0, 0,
            0, 0);
    dayCells = new ArrayList<IDayCell>(42);
    for (int i = 0; i < 42; i++) {
        DayCell dayCell = new DayCell();
        dayCells.add(dayCell);
    }

    locale = Locale.getDefault();
    computeWeekdayNames();
    computeDayCellValues();
}

From source file:com.turn.sorcerer.pipeline.impl.CronPipeline.java

License:Open Source License

private int getIterationNumber(DateTime dt, int dayIterNo) {
    int year = dt.getYear();
    int month = dt.getMonthOfYear();
    int day = dt.getDayOfMonth();

    return (((year % 100) * 10000) + (month * 100) + day) * 10000 + dayIterNo;
}

From source file:com.turn.sorcerer.pipeline.impl.CronPipeline.java

License:Open Source License

private int getLastIterNoForDate(DateTime dt) {
    int iterNo = 0;
    DateTime _next = new DateTime().withYear(dt.getYear()).withDayOfYear(dt.getDayOfYear()).withHourOfDay(0)
            .withMinuteOfHour(0).withSecondOfMinute(0);

    while (_next.getDayOfMonth() == dt.getDayOfMonth()) {
        _next = cronExp.getNextTimeAfter(_next);
        iterNo++;//from  www  .  jav a 2s .  co m
    }

    return iterNo;
}

From source file:com.tysanclan.site.projectewok.TysanPage.java

License:Open Source License

public boolean isAprilFoolsDay(int year) {
    final DateTime easternStandardTime = new DateTime(DateTimeZone.forID("EST"));

    return easternStandardTime.getDayOfMonth() == 1 && easternStandardTime.getMonthOfYear() == 4
            && easternStandardTime.getYear() == year;
}

From source file:com.uber.hoodie.cli.utils.HiveUtil.java

License:Apache License

public static long countRecords(String jdbcUrl, HoodieTableMetaClient source, String srcDb, int partitions,
        String user, String pass) throws SQLException {
    DateTime dateTime = DateTime.now();
    String endDateStr = dateTime.getYear() + "-" + String.format("%02d", dateTime.getMonthOfYear()) + "-"
            + String.format("%02d", dateTime.getDayOfMonth());
    dateTime = dateTime.minusDays(partitions);
    String startDateStr = dateTime.getYear() + "-" + String.format("%02d", dateTime.getMonthOfYear()) + "-"
            + String.format("%02d", dateTime.getDayOfMonth());
    System.out.println("Start date " + startDateStr + " and end date " + endDateStr);
    return countRecords(jdbcUrl, source, srcDb, startDateStr, endDateStr, user, pass);
}

From source file:com.viridiansoftware.metrics.elasticsearch.ElasticsearchReporter.java

License:Open Source License

@Override
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
        SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
        SortedMap<String, Timer> timers) {
    long timestamp = clock.getTime();
    final DateTime dateTime = new DateTime(DateTimeZone.UTC);

    StringBuilder indexBuilder = new StringBuilder();
    indexBuilder.append(elasticsearchIndexPrefix);
    indexBuilder.append(dateTime.getYear());
    indexBuilder.append(DATE_DELIMETER);
    indexBuilder.append(TWO_DIGIT_FORMAT.format(dateTime.getMonthOfYear()));
    indexBuilder.append(DATE_DELIMETER);
    indexBuilder.append(TWO_DIGIT_FORMAT.format(dateTime.getDayOfMonth()));

    String index = indexBuilder.toString();

    try {//from   w w w  . j ava2 s .  co  m
        for (Map.Entry<String, Gauge> entry : gauges.entrySet()) {
            reportGauge(index, timestamp, entry.getKey(), entry.getValue());
        }

        for (Map.Entry<String, Counter> entry : counters.entrySet()) {
            reportCounter(index, timestamp, entry.getKey(), entry.getValue());
        }

        for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
            reportHistogram(index, timestamp, entry.getKey(), entry.getValue());
        }

        for (Map.Entry<String, Meter> entry : meters.entrySet()) {
            reportMetered(index, timestamp, entry.getKey(), entry.getValue());
        }

        for (Map.Entry<String, Timer> entry : timers.entrySet()) {
            reportTimer(index, timestamp, entry.getKey(), entry.getValue());
        }

        sendBulkRequest();
    } catch (IOException e) {
        LOGGER.warn("Unable to report to Elasticsearch", e);
    }
}

From source file:com.yahoo.sql4d.indexeragent.meta.Utils.java

License:Open Source License

public static String day(DateTime dt) {
    return twoFormat.format(dt.getDayOfMonth());
}

From source file:com.zaradai.kunzite.trader.services.md.eod.compact.CompactEodEncoder.java

License:Apache License

private void writeDate(DataOutput dataOutput, EodData entry) throws IOException {
    DateTime date = entry.getDate();

    dataOutput.writeShort(date.getYear());
    dataOutput.writeByte(date.getMonthOfYear());
    dataOutput.writeByte(date.getDayOfMonth());
}

From source file:com.zfer.kit.DateKit.java

License:Apache License

/**
 * get day./* w w  w  .j  a v  a2  s . c o  m*/
 *
 * @param date input date
 * @return day of date object
 */
public static int getDay(Date date) {
    DateTime dt = new DateTime(date);
    return dt.getDayOfMonth();
}

From source file:controllers.ReporteFechaController.java

public String construirStringFechaYHora(DateTime fechaYHora) {
    String fechaString = fechaYHora.getDayOfMonth() + "/" + fechaYHora.getMonthOfYear() + "/"
            + fechaYHora.getYear();//from ww  w  .ja v a 2 s.c  o m

    return fechaString;
}