How to compare two time stamp in format “Month Date hh:mm:ss” to check +ve or -ve value

后端 未结 3 1139
半阙折子戏
半阙折子戏 2020-11-30 14:20

I checked the stackoverflow site for my answer, i did not get, so i am posting it here.

My problem is:

How to compare two time stamp in format

3条回答
  •  情书的邮戳
    2020-11-30 15:10

    Here is a very easy way solution to solve your problem. If in your case the comparing depends on the time. If so, you can turn your time variables into string so you can compare them as a string. ONLY if the base of the comparison is the hour and minute and second elements and/or the day. It will look like this:

    string time1 = "Mar 21 11:51:20";
    string time2 = "Mar 21 10:20:05";
    
    cout<time2)cout<

提交回复
热议问题