Example usage for org.joda.time LocalDateTime LocalDateTime

List of usage examples for org.joda.time LocalDateTime LocalDateTime

Introduction

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

Prototype

public LocalDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour,
        int secondOfMinute) 

Source Link

Document

Constructs an instance set to the specified date and time using ISOChronology.

Usage

From source file:cherry.foundation.type.jdbc.DatetimeDao.java

License:Apache License

public List<VerifyDatetime> selectAllWithMask() {
    Map<String, Masker<?>> maskerMap = new HashMap<>();
    maskerMap.put("dt", SqlDateMasker.newMasker(new LocalDate(2000, 1, 1), true, true, true));
    maskerMap.put("tm", SqlTimeMasker.newMasker(new LocalTime(0, 0, 0), true, true, true));
    maskerMap.put("dtm", SqlTimestampMasker.newMasker(new LocalDateTime(2000, 1, 1, 0, 0, 0), true, true, true,
            true, true, true));//from  ww w .  j a  v a  2 s  .  com
    return namedParameterJdbcOperations.query(selectAllSql,
            rowMapperCreator.create(VerifyDatetime.class, maskerMap));
}

From source file:cherry.foundation.type.jdbc.JdbcDao.java

License:Apache License

public List<ConversionTest> selectAllWithMask() {
    Map<String, Masker<?>> maskerMap = new HashMap<>();
    maskerMap.put("jodaDate", SqlDateMasker.newMasker(new LocalDate(2000, 1, 1), true, true, true));
    maskerMap.put("jodaTime", SqlTimeMasker.newMasker(new LocalTime(0, 0, 0), true, true, true));
    maskerMap.put("jodaDatetime", SqlTimestampMasker.newMasker(new LocalDateTime(2000, 1, 1, 0, 0, 0), true,
            true, true, true, true, true));
    return namedParameterJdbcOperations.query(selectAllSql,
            rowMapperCreator.create(ConversionTest.class, maskerMap));
}

From source file:com.ramzcalender.utils.CalUtil.java

License:Open Source License

/**
        * Initial calculation of the week
        */*from www  . j ava2s . c o  m*/
        * @param
        *//*
           public void calculate(Context mContext,LocalDateTime currentDateTime)
           {
                   
                   
                   
           //        //Initializing Start with current month
           //        final LocalDateTime currentDateTime = new LocalDateTime();
                   
           setStartDate(currentDateTime.getYear(), currentDateTime.getMonthOfYear(), currentDateTime.getDayOfMonth());
                   
           int weekGap = CalUtil.mDateGap(currentDateTime.dayOfWeek().getAsText().substring(0, 3).toLowerCase());
                   
                   
           if (weekGap != 0) {
               //if the current date is not the first day of the week the rest of days is added
                   
             */
/*  //Calendar set to the current date
Calendar calendar = Calendar.getInstance();
        
calendar.add(Calendar.DAY_OF_YEAR, -weekGap);
        
//now the date is weekGap days back
Log.i("weekGap", "" + calendar.getTime().toString());
        
LocalDateTime ldt = LocalDateTime.fromCalendarFields(calendar);
        
*//*
       LocalDateTime ldt=currentDateTime.minusDays(weekGap);
       setStartDate(ldt.getYear(), ldt.getMonthOfYear(), ldt.getDayOfMonth());
           
           
           
   }
     }*/

/*Set The Start day (week)from calender*/
private void setStartDate(int year, int month, int day) {

    mStartDate = new LocalDateTime(year, month, day, 0, 0, 0);
    selectedDate = mStartDate;

    AppController.getInstance().setDate(selectedDate);

}

From source file:com.weekcalendar.utils.CalUtil.java

License:Open Source License

private void setStartDate(int year, int month, int day) {

    mStartDate = new LocalDateTime(year, month, day, 0, 0, 0);
    selectedDate = mStartDate;//from  w  w  w .  j a  v a  2 s.  co m

    AppController.getInstance().setDate(selectedDate);

}

From source file:de.avanux.smartapplianceenabler.appliance.TimeOfDayOfWeek.java

License:Open Source License

public LocalDateTime toNextOccurrence(LocalDateTime now) {
    LocalDateTime dateTime = new LocalDateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(),
            getHour(), getMinute(), getSecond());
    while (dateTime.get(DateTimeFieldType.dayOfWeek()) != dayOfWeek) {
        dateTime = dateTime.plusDays(1);
    }//w ww  .  j  a v a  2 s  .c  o  m
    return dateTime;
}

From source file:de.avanux.smartapplianceenabler.appliance.TimeOfDayOfWeek.java

License:Open Source License

public LocalDateTime toLastOccurrence(LocalDateTime now) {
    LocalDateTime dateTime = new LocalDateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(),
            getHour(), getMinute(), getSecond());
    while (dateTime.get(DateTimeFieldType.dayOfWeek()) != dayOfWeek) {
        dateTime = dateTime.minusDays(1);
    }//from ww  w. ja va  2 s . c  o m
    return dateTime;
}

From source file:eu.europa.ec.grow.espd.xml.common.importing.UblRequestResponseImporter.java

License:EUPL

protected final Date readIssueDate(IssueDateType issueDateType, IssueTimeType issueTimeType) {
    if (issueDateType == null || issueDateType.getValue() == null) {
        return null;
    }/*w  w w.j  a va2s  .  c  om*/

    LocalDate localDate = issueDateType.getValue();
    if (issueTimeType != null && issueTimeType.getValue() != null) {
        LocalTime localTime = issueTimeType.getValue();
        return new LocalDateTime(localDate.getYear(), localDate.getMonthOfYear(), localDate.getDayOfMonth(),
                localTime.getHourOfDay(), localTime.getMinuteOfHour(), localTime.getSecondOfMinute()).toDate();
    }

    return new LocalDateTime(localDate.getYear(), localDate.getMonthOfYear(), localDate.getDayOfMonth(), 0, 0,
            0).toDate();
}

From source file:eu.smartenit.unada.sm.MonitorRunner.java

License:Apache License

/**
 * Returns the upload date of a given object.
 *
 * @param upload_date The upload date object.
 * @return The upload date of the given object.
 *//*ww w  .ja  v a 2 s  . co m*/
private Date toDate(Object upload_date) {
    String sourceDate = (String) upload_date;
    sourceDate = sourceDate.replaceAll("-", ":");
    sourceDate = sourceDate.replaceAll(" ", ":");
    String[] splitDate = sourceDate.split(":");

    int year = Integer.parseInt(splitDate[0]);
    int month = Integer.parseInt(splitDate[1]);
    int day = Integer.parseInt(splitDate[2]);
    int hour = Integer.parseInt(splitDate[3]);
    int minute = Integer.parseInt(splitDate[4]);
    int second = Integer.parseInt(splitDate[5]);

    LocalDateTime dateTime = new LocalDateTime(year, month, day, hour, minute, second);
    return dateTime.toDate();
}

From source file:io.github.benas.randombeans.randomizers.jodatime.registry.JodaTimeUtils.java

License:Open Source License

public static org.joda.time.LocalDateTime toJodaLocalDateTime(final LocalDate localDate,
        final LocalTime localTime) {
    return new LocalDateTime(localDate.getYear(), localDate.getMonthValue(), localDate.getDayOfMonth(),
            localTime.getHour(), localTime.getMinute(), localTime.getSecond());
}

From source file:net.sourceforge.fenixedu.domain.teacher.Career.java

License:Open Source License

public PossiblyNullEndedInterval getInterval() {
    if (getEndYear() != null) {
        return new PossiblyNullEndedInterval(
                new LocalDateTime(getBeginYear(), 1, 1, 0, 0, 0).toDateTime().getMillis(),
                new LocalDateTime(getEndYear(), 1, 1, 0, 0, 0).toDateTime().getMillis());
    } else {//  w  w w .  ja  va2s  . c  om
        return new PossiblyNullEndedInterval(
                new LocalDateTime(getBeginYear(), 1, 1, 0, 0, 0).toDateTime().getMillis());
    }
}