Java ZonedDateTime Calculate getZonedDateTimeForComparison(TimeZone zone)

Here you can find the source of getZonedDateTimeForComparison(TimeZone zone)

Description

Get a ZonedDateTime for comparison on membership dates

License

Open Source License

Parameter

Parameter Description
zone the TimeZone

Return

the ZonedDateTime

Declaration

public static ZonedDateTime getZonedDateTimeForComparison(TimeZone zone) 

Method Source Code

//package com.java2s;
/*//from ww  w  . jav a 2s.c  o m
 * Copyright (c) Interactive Information R & D (I2RD) LLC.
 * All Rights Reserved.
 *
 * This software is confidential and proprietary information of
 * I2RD LLC ("Confidential Information"). You shall not disclose
 * such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered
 * into with I2RD.
 */

import java.time.ZonedDateTime;

import java.time.temporal.ChronoUnit;

import java.util.TimeZone;

public class Main {
    /**
     * Get a ZonedDateTime for comparison on membership dates
     *
     * @param zone the TimeZone
     *
     * @return the ZonedDateTime
     */
    public static ZonedDateTime getZonedDateTimeForComparison(TimeZone zone) {
        ZonedDateTime dt = ZonedDateTime.now(zone.toZoneId());
        dt = dt.plus(1L, ChronoUnit.HOURS);
        dt = dt.truncatedTo(ChronoUnit.HOURS);
        return dt;
    }
}

Related

  1. getShortStringDate(ZonedDateTime time)
  2. getStartOfDay(ZoneId zoneId, ZonedDateTime time)
  3. getStartOfWeek(ZoneId zoneId, ZonedDateTime time)
  4. getTime(ZonedDateTime zonedTime)
  5. getTimePath(Path dir, String ext, ZonedDateTime dateTime)
  6. holidaysInRange(ZonedDateTime startDate, ZonedDateTime endDate, List holidays)
  7. isBetweenTimesInclusive(ZonedDateTime dateTime, ZonedDateTime startDateTime, ZonedDateTime endDateTime)
  8. isoDateTime(ZonedDateTime zonedDateTime)
  9. mapToZonedDateTime(final Date date)