DRDE/ACTK1_0/se/EPPDateFormatter.cpp

26 lines
540 B
C++
Raw Permalink Normal View History

#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;
}
}