-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
In the documentation to Poco::DateTimeParser:.parse(const
std::string& fmt, const std::string& str, int& timeZoneDifferential)
Parses a date and time in the given format from the given string.
Throws a SyntaxException if the string cannot be successfully parsed.
As I understand this sentence the given datestring "str" must be in
the format described in paramter "fmt", otherwise a SyntaxException is thrown - or do I miss something ?
But even if i give wrong format like "sjdcg-12987-kjchsjkc" or an empty format. its parsing the string and giving some garbage value.
How can i solve this issue:
the code is like this-
string datetime="jnghjgnbcfjb";
try
{
DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT,datetime,dt,tzd);
}
catch(const Poco::Exception& exc)
{
cout << exc.displayText() << endl;
}