当前位置: 首页>>代码示例>>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;未经允许,请勿转载。