DRDE/AusRegEPPTK/se/EPPDateFormatter.cpp

26 lines
540 B
C++
Raw Normal View History

2013-12-31 19:36:07 +00:00
#include "se/EPPDateFormatter.hpp"
#include "se/XMLGregorianCalendar.hpp"
#include <sstream>
std::string EPPDateFormatter::toXSDateTime(const XMLGregorianCalendar& date)
{
return date.toXMLFormat();
}
std::string EPPDateFormatter::toXSDate(const XMLGregorianCalendar& date)
{
return date.format("%Y-%M-%D");
}
XMLGregorianCalendar* EPPDateFormatter::fromXSDateTime(const std::string &dateTime)
{
try
{
return new XMLGregorianCalendar(dateTime);
}
catch (MalformedDateException& e)
{
return NULL;
}
}