Example usage for javax.xml.datatype XMLGregorianCalendar setSecond

List of usage examples for javax.xml.datatype XMLGregorianCalendar setSecond

Introduction

In this page you can find the example usage for javax.xml.datatype XMLGregorianCalendar setSecond.

Prototype

public abstract void setSecond(int second);

Source Link

Document

Set seconds.

Usage

From source file:org.techytax.util.DateHelper.java

public static XMLGregorianCalendar getDateForXml(Date date) {
    XMLGregorianCalendar calendar = null;
    try {//from   w w  w.  j  av a2  s.  co m
        calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
    } catch (DatatypeConfigurationException e) {
        e.printStackTrace();
    }
    calendar.setDay(getDay(date));
    calendar.setMonth(getMonth(date) + 1);
    calendar.setYear(getYear(date));
    calendar.setHour(0);
    calendar.setMinute(0);
    calendar.setSecond(0);
    return calendar;
}