Perhaps something like where p1 and p2 are as you defined them
time_duration onehour(1,0,0);
if (p2 > (p1 + onehour)) {
return false;
}
Larry
----- Original Message -----
From: "tonyaim83"
Hi I'm using Date time library for the first time so no idea how best make use of it. My primary target is to check if the first timestamp and second timestamp entered by the user are in a span of one hour. Format of input string is as follows YYYYDDMM-HH:MM:SS(20071015-17:47:10) Now if the second string is also in the an hour span it should return true otherwise false. I m thinking of doing this like std::string to_iso_string(date d1) ptime p1(d1, time_duration("17:21:23")); std::string to_iso_string(date d2) ptime p2(d2, time_duration("17:22:23"));
ptime p3=p2-p1; if (p3>1) { return false; } I could also find a function which has a separator T std::string to_iso_extended_string(ptime); How can i make use of this function as in my case the separtor of date- time is "-" Or a better way to perform the same task.
-- View this message in context: http://www.nabble.com/Help-needed-on-time-date-tp14486644p14486644.html Sent from the Boost - Users mailing list archive at Nabble.com.