當前位置: 首頁>>代碼示例>>Java>>正文


Java ZonedDateTime.getZone方法代碼示例

本文整理匯總了Java中java.time.ZonedDateTime.getZone方法的典型用法代碼示例。如果您正苦於以下問題:Java ZonedDateTime.getZone方法的具體用法?Java ZonedDateTime.getZone怎麽用?Java ZonedDateTime.getZone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.ZonedDateTime的用法示例。


在下文中一共展示了ZonedDateTime.getZone方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isEqualTo

import java.time.ZonedDateTime; //導入方法依賴的package包/類
@Override
public final boolean isEqualTo(int index, ZonedDateTime value) {
    if (value == null) {
        return isNull(index);
    } else {
        final long epochMills = value.toInstant().toEpochMilli();
        if (epochMills != values.get(index)) {
            return false;
        } else {
            final ZoneId zoneId = value.getZone();
            final short code1 = zoneIdMap1.get(zoneId);
            final short code2 = zoneIds.get(index);
            return code1 == code2;
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:17,代碼來源:SparseArrayOfZonedDateTimes.java

示例2: isEqualTo

import java.time.ZonedDateTime; //導入方法依賴的package包/類
@Override
public final boolean isEqualTo(int index, ZonedDateTime value) {
    final long epochMillis = byteBuffer.getLong(index * BYTE_COUNT);
    if (value == null) {
        return epochMillis == nullValue;
    } else {
        final long valueAsEpochMills = value.toInstant().toEpochMilli();
        if (epochMillis == valueAsEpochMills) {
            return false;
        } else {
            final ZoneId zoneId = value.getZone();
            final short code1 = zoneIdMap1.get(zoneId);
            final short code2 = byteBuffer.getShort(index * BYTE_COUNT + 8);
            return code1 == code2;
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:18,代碼來源:MappedArrayOfZonedDateTimes.java

示例3: isEqualTo

import java.time.ZonedDateTime; //導入方法依賴的package包/類
@Override
public final boolean isEqualTo(int index, ZonedDateTime value) {
    if (value == null) {
        return values[index] == nullValue;
    } else {
        final long epochMills = value.toInstant().toEpochMilli();
        if (epochMills != values[index]) {
            return false;
        } else {
            final ZoneId zoneId = value.getZone();
            final short code1 = zoneIdMap1.get(zoneId);
            final short code2 = zoneIds[index];
            return code1 == code2;
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:17,代碼來源:DenseArrayOfZonedDateTimes.java

示例4: isTimeOut

import java.time.ZonedDateTime; //導入方法依賴的package包/類
public static boolean isTimeOut(ZonedDateTime start, ZonedDateTime target, long timeOutSeconds) {
    if (start.getZone() != ZONE_UTC) {
        start = toUtc(start);
    }

    if (target.getZone() != ZONE_UTC) {
        target = toUtc(target);
    }

    final long runningInSeconds = ChronoUnit.SECONDS.between(start, target);
    return runningInSeconds >= timeOutSeconds;
}
 
開發者ID:FlowCI,項目名稱:flow-platform,代碼行數:13,代碼來源:DateUtil.java

示例5: toUtc

import java.time.ZonedDateTime; //導入方法依賴的package包/類
public static ZonedDateTime toUtc(ZonedDateTime zonedDateTime) {
    if (zonedDateTime.getZone() != ZONE_UTC) {
        return zonedDateTime.withZoneSameInstant(DateUtil.ZONE_UTC);
    }
    return zonedDateTime;
}
 
開發者ID:FlowCI,項目名稱:flow-platform,代碼行數:7,代碼來源:DateUtil.java

示例6: adjustTime

import java.time.ZonedDateTime; //導入方法依賴的package包/類
/**
 * Adjusts the given time either rounding it up or down.
 *
 * @param time
 *            the time to adjust
 * @param roundUp
 *            the rounding direction
 * @param firstDayOfWeek
 *            the first day of the week (needed for rounding weeks)
 * @return the adjusted time
 */
public ZonedDateTime adjustTime(ZonedDateTime time, boolean roundUp,
                                DayOfWeek firstDayOfWeek) {
    Instant instant = time.toInstant();
    ZoneId zoneId = time.getZone();
    instant = adjustTime(instant, zoneId, roundUp, firstDayOfWeek);
    return ZonedDateTime.ofInstant(instant, zoneId);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:19,代碼來源:VirtualGrid.java

示例7: Interval

import java.time.ZonedDateTime; //導入方法依賴的package包/類
/**
 * Constructs a new time interval with the given start and end zoned dates /
 * times. The time zone will be initialized with the time zone of the start
 * date time. However, if the zone ID of the second argument is different then
 * an exception will be thrown.
 *
 * @throws IllegalArgumentException if two different time zones are used
 *
 * @param zonedStartDateTime the start date and time (e.g. Oct. 3rd, 2015, 6:15pm)
 * @param zonedEndDateTime   the end date and time
 */
public Interval(ZonedDateTime zonedStartDateTime, ZonedDateTime zonedEndDateTime) {
    this(zonedStartDateTime.toLocalDateTime(), zonedEndDateTime.toLocalDateTime(), zonedStartDateTime.getZone());

    if (!zonedStartDateTime.getZone().equals(zonedEndDateTime.getZone())) {
        throw new IllegalArgumentException("the zoned start and end times use different time zones, zone1 = " + zonedStartDateTime.getZone() +
                ", zone2 = " + zonedEndDateTime.getZone());
    }
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:20,代碼來源:Interval.java


注:本文中的java.time.ZonedDateTime.getZone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。