Date comparison - How to check if 20 minutes have passed?

后端 未结 6 1782
遇见更好的自我
遇见更好的自我 2021-02-05 00:44

How to check if 20 minutes have passed from current date?

For example:

var start = DateTime.Now;
var oldDate = \"08/10/2011 23:50:31\"; 

    if(start ?         


        
6条回答
  •  旧巷少年郎
    2021-02-05 01:29

    var start = DateTime.Now;
    var oldDate = DateTime.Parse("08/10/2011 23:50:31"); 
    
        if(start.Subtract(oldDate) >= TimeSpan.FromMinutes(20)) 
        {
         //20 minutes were passed from start
        }
    

提交回复
热议问题