javax.xml.datatype.XMLGregorianCalendar.setDay()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.setDay()方法的一些代码示例,展示了XMLGregorianCalendar.setDay()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.setDay()方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:setDay

XMLGregorianCalendar.setDay介绍

[英]Set days in month.

Unset this field by invoking the setter with a parameter value of DatatypeConstants#FIELD_UNDEFINED.
[中]设定月份的天数。
通过调用参数值为DatatypeConstants#field_UNDEFINED的setter来取消设置此字段。

代码示例

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore

@Override
public void setDay(int day)
{
 xmlGregorianCalendar.setDay(day);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore

@Override
public void setDay(int day)
{
 xmlGregorianCalendar.setDay(day);
}

代码示例来源:origin: mulesoft/mule

@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
 XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
 xmlCal.setYear(1900);
 xmlCal.setMonth(1);
 xmlCal.setDay(1);
 assertEquals(1900, new DateTime(xmlCal).getYear());
 assertEquals(1, new DateTime(xmlCal).getMonth());
 assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}

代码示例来源:origin: mulesoft/mule

@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
 XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
 xmlCal.setYear(1900);
 xmlCal.setMonth(1);
 xmlCal.setDay(1);
 assertEquals(1900, new DateTime(xmlCal).getYear());
 assertEquals(1, new DateTime(xmlCal).getMonth());
 assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}

代码示例来源:origin: mulesoft/mule

@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
 XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
 xmlCal.setYear(1900);
 xmlCal.setMonth(1);
 xmlCal.setDay(1);
 assertEquals(1900, new DateTime(xmlCal).getYear());
 assertEquals(1, new DateTime(xmlCal).getMonth());
 assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}

代码示例来源:origin: org.openprovenance.prov/prov-model

public XMLGregorianCalendar newGDay(int day) {
  XMLGregorianCalendar cal=dataFactory.newXMLGregorianCalendar();
  cal.setDay(day);
  return cal;
}

代码示例来源:origin: lucmoreau/ProvToolbox

public XMLGregorianCalendar newGMonthDay(int month, int day) {
  XMLGregorianCalendar cal=dataFactory.newXMLGregorianCalendar();
  cal.setMonth(month);
  cal.setDay(day);
  return cal;
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
  calendar.setDay(date.getDate());
}

代码示例来源:origin: org.openprovenance.prov/prov-model

public XMLGregorianCalendar newGMonthDay(int month, int day) {
  XMLGregorianCalendar cal=dataFactory.newXMLGregorianCalendar();
  cal.setMonth(month);
  cal.setDay(day);
  return cal;
}

代码示例来源:origin: highsource/hyperjaxb3

@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
  calendar.setDay(date.getDate());
}

代码示例来源:origin: stackoverflow.com

XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar();
GregorianCalendar now = new GregorianCalendar();
xgc.setYear(now.get(Calendar.YEAR));
xgc.setMonth(now.get(Calendar.MONTH) + 1);
xgc.setDay(now.get(Calendar.DAY_OF_MONTH));
System.out.println(xgc);

代码示例来源:origin: com.kloudtek.ktutils/ktutils-core

public static XMLGregorianCalendar convertDate(Date date) {
  try {
    Calendar c = new GregorianCalendar();
    c.setTime(date);
    XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
    xmlGregorianCalendar.setDay(c.get(Calendar.DAY_OF_MONTH));
    xmlGregorianCalendar.setMonth(c.get(Calendar.MONTH));
    xmlGregorianCalendar.setYear(c.get(Calendar.YEAR));
    return xmlGregorianCalendar;
  } catch (DatatypeConfigurationException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.kloudtek.ktutils/ktutils-xml

public static XMLGregorianCalendar convertDate(Date date) {
  try {
    Calendar c = new GregorianCalendar();
    c.setTime(date);
    XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
    xmlGregorianCalendar.setDay(c.get(Calendar.DAY_OF_MONTH));
    xmlGregorianCalendar.setMonth(c.get(Calendar.MONTH));
    xmlGregorianCalendar.setYear(c.get(Calendar.YEAR));
    return xmlGregorianCalendar;
  } catch (DatatypeConfigurationException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
  calendar.setMonth(date.getMonth() + 1);
  calendar.setDay(date.getDate());
}

代码示例来源:origin: highsource/hyperjaxb3

@SuppressWarnings("deprecation")
@Override
public void createCalendar(Date date, XMLGregorianCalendar calendar) {
  calendar.setMonth(date.getMonth() + 1);
  calendar.setDay(date.getDate());
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

@SuppressWarnings("deprecation")
  @Override
  public void createCalendar(Date date, XMLGregorianCalendar calendar) {
    calendar.setYear(date.getYear() + 1900);
    calendar.setMonth(date.getMonth() + 1);
    calendar.setDay(date.getDate());
  }
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

@SuppressWarnings("deprecation")
  @Override
  public void createCalendar(Date date, XMLGregorianCalendar calendar) {
    calendar.setYear(date.getYear() + 1900);
    calendar.setMonth(date.getMonth() + 1);
    calendar.setDay(date.getDate());
    calendar.setHour(date.getHours());
    calendar.setMinute(date.getMinutes());
    calendar.setSecond(date.getSeconds());
    calendar.setMillisecond((int) (date.getTime() % 1000));
  }
}

代码示例来源:origin: highsource/hyperjaxb3

@SuppressWarnings("deprecation")
  @Override
  public void createCalendar(Date date, XMLGregorianCalendar calendar) {
    calendar.setYear(date.getYear() + 1900);
    calendar.setMonth(date.getMonth() + 1);
    calendar.setDay(date.getDate());
    calendar.setHour(date.getHours());
    calendar.setMinute(date.getMinutes());
    calendar.setSecond(date.getSeconds());
    calendar.setMillisecond((int) (date.getTime() % 1000));
  }
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
 XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
 xmlCal.setYear(1900);
 xmlCal.setMonth(1);
 xmlCal.setDay(1);
 assertEquals(1900, new DateTime(xmlCal).getYear());
 assertEquals(1, new DateTime(xmlCal).getMonth());
 assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void fromXMLCalendar() throws DatatypeConfigurationException {
 XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
 xmlCal.setYear(1900);
 xmlCal.setMonth(1);
 xmlCal.setDay(1);
 assertEquals(1900, new DateTime(xmlCal).getYear());
 assertEquals(1, new DateTime(xmlCal).getMonth());
 assertEquals(1, new DateTime(xmlCal).getDayOfMonth());
}

相关文章