Java ZonedDateTime Calculate getStartOfDay(ZoneId zoneId, ZonedDateTime time)

Here you can find the source of getStartOfDay(ZoneId zoneId, ZonedDateTime time)

Description

get Start Of Day

License

Mozilla Public License

Declaration

public static ZonedDateTime getStartOfDay(ZoneId zoneId, ZonedDateTime time) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2017 Stichting Yona Foundation This Source Code Form is subject to the terms of the Mozilla Public License, v.
 * 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *******************************************************************************/

import java.time.ZoneId;

import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;

public class Main {
    public static ZonedDateTime getStartOfDay(ZoneId zoneId, ZonedDateTime time) {
        return time.withZoneSameInstant(zoneId).truncatedTo(ChronoUnit.DAYS);
    }//w  ww . ja v  a  2s  .c o m
}

Related

  1. equals(ZonedDateTime ZDT1, ZonedDateTime ZDT2)
  2. filter(final Set list, final ZonedDateTime base, final long minute)
  3. findIdx(int startidx, int endidx, ZonedDateTime endDate, List holidays)
  4. getDuration(ZonedDateTime input, TemporalField roundTo, int roundIncrement)
  5. getShortStringDate(ZonedDateTime time)
  6. getStartOfWeek(ZoneId zoneId, ZonedDateTime time)
  7. getTime(ZonedDateTime zonedTime)
  8. getTimePath(Path dir, String ext, ZonedDateTime dateTime)
  9. getZonedDateTimeForComparison(TimeZone zone)