diff --git a/date/date.h b/date/date.h index fd896b0..e108807 100644 --- a/date/date.h +++ b/date/date.h @@ -407,7 +407,7 @@ public: this method doesn't test if the values are correct use IsCorrectDate() to check - */ + */ template bool ParseTime(const CStringType * str, const CStringType ** str_after = 0); @@ -415,6 +415,28 @@ public: bool ParseTime(const StringType & str); + /* + parsing month, day, hour and minutes (if exists) and seconds (if exists) + the input string can be as follows: + "10-23 14" -- only month, day and hour given (min and sec will be zero) + "10-23 14:10" -- month, day and hour with minutes (sec will be zero) + "10-23 14:10:35" -- month, day, hour, minutes and seconds + + white characters are ommited so these are valid strings too: + " 10 - 23 14 : 10 : 35 " + " 10 - 23 14 : 10 : 35some text " + a white character means a space or a tab + + this method doesn't test if the values are correct + use IsCorrectDate() to check + */ + template + bool ParseMonthDayTime(const CStringType * str, const CStringType ** str_after = 0); + + template + bool ParseMonthDayTime(const StringType & str); + + /* parsing year/month/day hour:min:sec the input strings can be as follows: @@ -685,6 +707,31 @@ bool Date::ParseTime(const StringType & str) +template +bool Date::ParseMonthDayTime(const CStringType * str, const CStringType ** str_after) +{ +const CStringType * after; +bool result = false; + + if( ParseMonthDay(str, &after) ) + if( ParseTime(after, &after) ) + result = true; + + SetAfter(after, str_after); + +return result; +} + + +template +bool Date::ParseMonthDayTime(const StringType & str) +{ + return ParseMonthDayTime(str.c_str()); +} + + + + template bool Date::Parse(const CStringType * str, const CStringType ** str_after) {