« Return to Thread: Help needed on time date

Help needed on time date

by tonyaim83 :: Rate this Message:

Reply to Author | View in Thread

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.
 

 « Return to Thread: Help needed on time date