Example usage for org.joda.time LocalDateTime toLocalDate

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

Introduction

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

Prototype

public LocalDate toLocalDate() 

Source Link

Document

Converts this object to a LocalDate with the same date and chronology.

Usage

From source file:cherry.goods.util.LocalDateUtil.java

License:Apache License

/**
 * (FROM)???/*from   w  w  w  .  j av  a2s . c o  m*/
 * 
 * @param from ??
 * @return ????(FROM)??
 */
public static LocalDate rangeFrom(LocalDateTime from) {
    if (from == null) {
        return null;
    }
    return from.toLocalDate();
}

From source file:cherry.goods.util.LocalDateUtil.java

License:Apache License

/**
 * (TO)???//  w w w.  j a v  a 2s  . c  o m
 * 
 * @param to ??
 * @return ????(TO)??
 */
public static LocalDate rangeTo(LocalDateTime to) {
    if (to == null) {
        return null;
    }
    return to.toLocalDate().plusDays(1);
}

From source file:cherry.sqlapp.controller.sqltool.search.SqltoolSearchControllerImpl.java

License:Apache License

@Override
public SqltoolSearchForm getForm() {
    LocalDate today = bizDateTime.today();
    SqltoolSearchForm form = new SqltoolSearchForm();

    LocalDateTime from = LocalDateTimeUtil.rangeFrom(today.minusDays(defaultFromDays));
    form.setRegisteredFromDt(from.toLocalDate());
    form.setRegisteredFromTm(from.toLocalTime());

    LocalDateTime to = LocalDateTimeUtil.rangeTo(today).minusSeconds(1);
    form.setRegisteredToDt(to.toLocalDate());
    form.setRegisteredToTm(to.toLocalTime());

    form.setSqlType(Arrays.asList(SqlType.CLAUSE, SqlType.STATEMENT, SqlType.LOAD));
    form.setPublished(Arrays.asList(Published.PUBLIC, Published.PRIVATE));
    return form;/* w  w  w  .  ja v  a2 s .  c  o  m*/
}

From source file:cherry.sqlman.tool.search.SqlSearchControllerImpl.java

License:Apache License

private void initializeForm(SqlSearchForm form) {

    LocalDate today = bizDateTime.today();

    LocalDateTime from = LocalDateTimeUtil.rangeFrom(today.minusDays(config.getSearchDefaultFromDays()));
    form.setRegisteredFromDt(from.toLocalDate());
    form.setRegisteredFromTm(from.toLocalTime());

    LocalDateTime to = LocalDateTimeUtil.rangeTo(today).minusSeconds(1);
    form.setRegisteredToDt(to.toLocalDate());
    form.setRegisteredToTm(to.toLocalTime());

    form.setSqlType(Arrays.asList(SqlType.CLAUSE, SqlType.STATEMENT, SqlType.LOAD));
    form.setPublished(Arrays.asList(Published.PUBLIC, Published.PRIVATE));
}

From source file:com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemDateTime.java

License:Open Source License

public CosemDateTime(final LocalDateTime dateTime, final int deviation, final ClockStatus clockStatus) {
    this(dateTime.toLocalDate(), dateTime.toLocalTime(), deviation, clockStatus);
}

From source file:com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemDateTime.java

License:Open Source License

public CosemDateTime(final LocalDateTime dateTime, final int deviation) {
    this(dateTime.toLocalDate(), dateTime.toLocalTime(), deviation);
}

From source file:com.alliander.osgp.dto.valueobjects.smartmetering.CosemDateTimeDto.java

License:Open Source License

public CosemDateTimeDto(final LocalDateTime dateTime, final int deviation, final ClockStatusDto clockStatus) {
    this(dateTime.toLocalDate(), dateTime.toLocalTime(), deviation, clockStatus);
}

From source file:com.alliander.osgp.dto.valueobjects.smartmetering.CosemDateTimeDto.java

License:Open Source License

public CosemDateTimeDto(final LocalDateTime dateTime, final int deviation) {
    this(dateTime.toLocalDate(), dateTime.toLocalTime(), deviation);
}

From source file:com.axelor.apps.production.service.ManufOrderStockMoveService.java

License:Open Source License

private StockMove _createToProduceStockMove(ManufOrder manufOrder, Company company) throws AxelorException {

    Location virtualLocation = productionConfigService
            .getProductionVirtualLocation(productionConfigService.getProductionConfig(company));

    LocalDateTime plannedEndDateT = manufOrder.getPlannedEndDateT();
    LocalDate plannedEndDate = plannedEndDateT != null ? plannedEndDateT.toLocalDate() : null;

    StockMove stockMove = stockMoveService.createStockMove(null, null, company, null, virtualLocation,
            manufOrder.getProdProcess().getLocation(), plannedEndDate, null);

    return stockMove;
}

From source file:com.axelor.csv.script.ImportDateTime.java

License:Open Source License

public String importDate(String inputDate) {

    String patDate = "(" + dt + "|TODAY)(\\[(" + String.format(pat, 4, "y") + "?" + String.format(pat, 2, "M")
            + "?" + String.format(pat, 2, "d") + "?" + ")\\])?";
    try {//from www .  j  a  v  a2  s .  co m
        if (!Strings.isNullOrEmpty(inputDate) && inputDate.matches(patDate)) {
            List<String> dates = Arrays.asList(inputDate.split("\\["));
            inputDate = dates.get(0).equals("TODAY") ? new LocalDateTime().toString("yyyy-MM-dd")
                    : dates.get(0);
            if (dates.size() > 1) {
                LocalDateTime dateTime = new LocalDateTime(inputDate);
                Matcher matcher = Pattern.compile(String.format(pat, 4, "y")).matcher(dates.get(1));
                if (matcher.find())
                    dateTime = updateYear(dateTime, matcher.group());
                matcher = Pattern.compile(String.format(pat, 2, "M")).matcher(dates.get(1));
                if (matcher.find())
                    dateTime = updateMonth(dateTime, matcher.group());
                matcher = Pattern.compile(String.format(pat, 2, "d")).matcher(dates.get(1));
                if (matcher.find())
                    dateTime = updateDay(dateTime, matcher.group());
                return dateTime.toLocalDate().toString();
            } else
                return inputDate;
        } else
            return null;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}