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


Java ZonedDateTime.getDayOfMonth方法代码示例

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


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

示例1: getInfo

import java.time.ZonedDateTime; //导入方法依赖的package包/类
private String getInfo() {
        ZonedDateTime localTime = mostRecentMessageTime.atZoneSameInstant(ZoneId.systemDefault());
        String time = String.format("%s:%02d", localTime.getHour()%12+1, localTime.getMinute()) + " "
                + ((localTime.getHour()>12) ? "PM" : "AM");

        String month = localTime.getMonth().name().substring(0,3).toLowerCase();
//        month = WordUtils.capitalize(month);

        String day = localTime.getDayOfWeek().name().substring(0,3).toLowerCase();
//        day = WordUtils.capitalize(day);

        String date = day + ", "
                + month + " "
                + localTime.getDayOfMonth();
        return user.getName() + " \u2022 " + date + " at " + time;
    }
 
开发者ID:MCPlummet,项目名称:TransparentDiscord,代码行数:17,代码来源:UIMessageGroup.java

示例2: testParseUTCDateTime

import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Test
public void testParseUTCDateTime() throws Exception {
    // ARRANGE
    String date = "2016-12-31T12:13:14Z";

    // ACT
    ZonedDateTime dateTime = FormatUtils.parseUTCTime(date);
    int year = dateTime.getYear();
    int dayOfMonth = dateTime.getDayOfMonth();
    int hour = dateTime.getHour();

    // ASSERT
    assertThat(year, equalTo(2016));
    assertThat(dayOfMonth, equalTo(31));
    assertThat(hour, equalTo(12));
}
 
开发者ID:salesforce,项目名称:pyplyn,代码行数:17,代码来源:FormatUtilsTest.java

示例3: testParseNonGMTDateTime

import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Test
public void testParseNonGMTDateTime() throws Exception {
    // ARRANGE
    String date = "2016-12-31T12:13:14-07:00";

    // ACT
    ZonedDateTime dateTime = FormatUtils.parseUTCTime(date);
    int year = dateTime.getYear();
    int dayOfMonth = dateTime.getDayOfMonth();
    int hour = dateTime.getHour();

    // ASSERT
    assertThat(year, equalTo(2016));
    assertThat(dayOfMonth, equalTo(31));
    assertThat(hour, equalTo(19));
}
 
开发者ID:salesforce,项目名称:pyplyn,代码行数:17,代码来源:FormatUtilsTest.java

示例4: getTime

import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Override
public long getTime() {
  ZonedDateTime time = stopWatch.getTime();
  long mSecs = ((time.getDayOfMonth() - 1) * 86400 + time.getHour() * 3600
      + time.getMinute() * 60 + time.getSecond()) * 1000
      + time.getNano() / 1000000;
  /*
   * int offset=time.getOffset().getTotalSeconds();
   * System.out.println(" d:"+(time.getDayOfMonth()-1));
   * System.out.println(" h:"+time.getHour());
   * System.out.println(" m:"+time.getMinute());
   * System.out.println(" s:"+time.getSecond());
   * System.out.println(" n:"+time.getNano());
   * System.out.println(" o:"+offset); System.out.println("ms:"+mSecs);
   */
  return mSecs;
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:18,代码来源:JFXStopWatch.java

示例5: 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

示例6: 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

示例7: 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

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