DRDE/AusRegEPPTK/se/EPPDateFormatter.cpp

26 lines
558 B
C++
Raw Normal View History

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