Java LocalDate Calculate newToOld(LocalDate d)

Here you can find the source of newToOld(LocalDate d)

Description

new To Old

License

Open Source License

Declaration

public static Date newToOld(LocalDate d) 

Method Source Code


//package com.java2s;
/*/*from w w w  .ja  v a  2 s .  c  om*/
 * Copyright (C) 2015 Joshua Michael Hertlein
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

public class Main {
    public static Date newToOld(LocalDateTime ldt) {
        return Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant());
    }

    public static Date newToOld(LocalDate d) {
        return newToOld(d.atStartOfDay());
    }
}

Related

  1. LocalDateFromMilli(long value)
  2. localDateToSystemAdjustedStartOfDayDate(LocalDate d)
  3. max(ChronoLocalDate date1, ChronoLocalDate date2)
  4. medTime(LocalDate date, String text)
  5. minusDaysAdjustedToStartOfDay(LocalDate ld, int days)
  6. next(Predicate p)
  7. normalizedYear(LocalDate d)
  8. obtenirLocalDateAPartirDUneDate(Date date)
  9. oneDayAfterNotificationRequired(LocalDate requestDate, LocalDate vehicleDetailsMotExpiryDate)