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


Java XMLGregorianCalendar.setMinute方法代码示例

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


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

示例1: toXMLCalendar

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
public XMLGregorianCalendar toXMLCalendar(Date d) throws Exception {  
    GregorianCalendar gc = new GregorianCalendar();  
    gc.setTime(d);  
    XMLGregorianCalendar xml = DatatypeFactory.newInstance()  
            .newXMLGregorianCalendar();  
    xml.setYear(gc.get(Calendar.YEAR));  
    xml.setMonth(gc.get(Calendar.MONTH) + 1);  
    xml.setDay(gc.get(Calendar.DAY_OF_MONTH));  
    xml.setHour(gc.get(Calendar.HOUR_OF_DAY));  
    xml.setMinute(gc.get(Calendar.MINUTE));  
    xml.setSecond(gc.get(Calendar.SECOND));  
    return xml;  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:14,代码来源:Docx4j_创建批注_S3_Test.java

示例2: checkToGregorianCalendar01

import javax.xml.datatype.XMLGregorianCalendar; //导入方法依赖的package包/类
@Test
public void checkToGregorianCalendar01() {

    XMLGregorianCalendar time_16_17_18 = datatypeFactory.newXMLGregorianCalendar("16:17:18");
    XMLGregorianCalendar date_2001_02_03 = datatypeFactory.newXMLGregorianCalendar("2001-02-03");
    GregorianCalendar calendar = date_2001_02_03.toGregorianCalendar(null, null, time_16_17_18);

    int year = calendar.get(YEAR);
    int minute = calendar.get(MINUTE);

    assertTrue((year == 2001 && minute == 17), " expecting year == 2001, minute == 17" + ", result is year == " + year + ", minute == " + minute);


    calendar = time_16_17_18.toGregorianCalendar(null, null, date_2001_02_03);

    year = calendar.get(YEAR);
    minute = calendar.get(MINUTE);

    assertTrue((year == 2001 && minute == 17), " expecting year == 2001, minute == 17" + ", result is year == " + year + ", minute == " + minute);


    date_2001_02_03.setMinute(3);
    date_2001_02_03.setYear(null);

    XMLGregorianCalendar date_time = datatypeFactory.newXMLGregorianCalendar("2003-04-11T02:13:01Z");

    calendar = date_2001_02_03.toGregorianCalendar(null, null, date_time);

    year = calendar.get(YEAR);
    minute = calendar.get(MINUTE);
    int hour = calendar.get(HOUR);

    assertTrue((year == 2003 && hour == 2 && minute == 3), " expecting year == 2003, hour == 2, minute == 3" + ", result is year == " + year + ", hour == " + hour + ", minute == " + minute);


}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:XMLGregorianCalendarTest.java


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