當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。