26 lines
558 B
C++
26 lines
558 B
C++
#include "se/EPPDateFormatter.hpp"
|
|
#include "se/XMLGregorianCalendar.hpp"
|
|
#include <sstream>
|
|
|
|
std::string EPPDateFormatter::toXSDateTime(constXMLGC::XMLGregorianCalendar& date)
|
|
{
|
|
return date.toXMLFormat();
|
|
}
|
|
|
|
std::string EPPDateFormatter::toXSDate(constXMLGC::XMLGregorianCalendar& date)
|
|
{
|
|
return date.format("%Y-%M-%D");
|
|
}
|
|
|
|
XMLGregorianCalendar* EPPDateFormatter::fromXSDateTime(const std::string &dateTime)
|
|
{
|
|
try
|
|
{
|
|
return newXMLGC::XMLGregorianCalendar(dateTime);
|
|
}
|
|
catch (MalformedDateException& e)
|
|
{
|
|
return NULL;
|
|
}
|
|
}
|