package ru.bitel.bgbilling.modules.tv.dyn.cti.tve.ws;

import java.util.Date;
import java.util.GregorianCalendar;

import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

public class TveUtils
{
	public static XMLGregorianCalendar toXmlCalendar( final Date date )
		throws Exception
	{
		if ( date == null )
		{
			return null;
		}

		GregorianCalendar calendar = new GregorianCalendar();
		calendar.setTime( date );

		return DatatypeFactory.newInstance().newXMLGregorianCalendar( calendar );
	}
}
