当前位置: 首页>>代码示例>>Java>>正文


Java ZonedDateTime.getMonthValue方法代码示例

本文整理汇总了Java中java.time.ZonedDateTime.getMonthValue方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.getMonthValue方法的具体用法?Java ZonedDateTime.getMonthValue怎么用?Java ZonedDateTime.getMonthValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.ZonedDateTime的用法示例。


在下文中一共展示了ZonedDateTime.getMonthValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encodeAsHex

import java.time.ZonedDateTime; //导入方法依赖的package包/类
public static String encodeAsHex(LocalDateTime dateTime) {
    ZonedDateTime zonedDateTime = dateTime.atZone(ZoneOffset.UTC);

    byte[] bytes = new byte[5];
    bytes[0] = (byte) (zonedDateTime.getYear() - 2000);
    bytes[1] = (byte) (zonedDateTime.getMonthValue());
    bytes[2] = (byte) (zonedDateTime.getDayOfMonth());
    bytes[3] = (byte) (zonedDateTime.getHour());
    bytes[4] = (byte) (zonedDateTime.getMinute());

    return Hex.encodeHexString(bytes);
}
 
开发者ID:amvnetworks,项目名称:amv-highmobility-cryptotool-wrapper,代码行数:13,代码来源:CryptotoolUtils.java

示例2: render

import java.time.ZonedDateTime; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void render(XCalendarFrame frame) {
	// Background
	final GC gc = frame.getGc();
	final boolean hovered = mouse.isEntered();
	final XCalendarModel model = popup.getModel();
	final XCalendarTheme theme = model.getTheme();
	final XVirtualCalendar calendar = model.getCalendar();
	
	ZoneId zoneId = model.getZoneId();
	final int year = calendar.getYear();
	final int month = query(calendar, zoneId, col, row);
	final ZonedDateTime d2 = calendar.getTravelDateTime();
	final ZonedDateTime d1 = calendar.getCalendarDateTime();
	boolean selected = isSameYear(d1, d2) && month == d1.getMonthValue();
	this.enabled = isValidYearMonth(year, month, zoneId, calendar::isValid);
	int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
	gc.setBackground(theme.getBackground(enabled, selected, false, hovered));
	gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());
	
	// Foreground
	String text = theme.getMonthTheme()[row][col];
	gc.setForeground(theme.getForeground(enabled, selected, true));
	gc.setFont(theme.getFont()); final Point size = extent(gc, text);
	gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
 
开发者ID:nextopcn,项目名称:xcalendar,代码行数:30,代码来源:XCalendarMonthWidget.java

示例3: isEqual

import java.time.ZonedDateTime; //导入方法依赖的package包/类
private static boolean isEqual(LocalDateTime ldt, Timestamp ts) {
    ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
    return zdt.getYear() == ts.getYear() + 1900 &&
           zdt.getMonthValue() == ts.getMonth() + 1 &&
           zdt.getDayOfMonth() == ts.getDate() &&
           zdt.getHour() == ts.getHours() &&
           zdt.getMinute() == ts.getMinutes() &&
           zdt.getSecond() == ts.getSeconds() &&
           zdt.getNano() == ts.getNanos();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:JavatimeTest.java

示例4: convertDateIntoYears

import java.time.ZonedDateTime; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static int convertDateIntoYears(String date) {
    String year = date.substring(0, 4);
    String month = date.substring(5, 7);
    String day = date.substring(8, 10);

    ZonedDateTime a = ZonedDateTime.now();
    Date newDate = new Date(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
    Date newDate1 = new Date(a.getYear(), a.getMonthValue(), a.getDayOfMonth());

    long time = newDate1.getTime() - newDate.getTime();
    int years = (int) ((time / (1000 * 60 * 60 * 24)) / 31 / 12);
    return years;
}
 
开发者ID:xSzymo,项目名称:Spring-web-shop-project,代码行数:15,代码来源:UserDAO.java

示例5: zonedDateTimeToDateValue

import java.time.ZonedDateTime; //导入方法依赖的package包/类
static DateValue zonedDateTimeToDateValue(ZonedDateTime dt) {
    return new DateTimeValueImpl(
            dt.getYear(), dt.getMonthValue(), dt.getDayOfMonth(),
            dt.getHour(), dt.getMinute(), dt.getSecond());
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:6,代码来源:ZonedDateTimeIteratorFactory.java


注:本文中的java.time.ZonedDateTime.getMonthValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。