c# - TimeSpan Time Calculation, Minutes - ho to convert time span to int -


i have folowing code,

now question best way preform this:

also take in notice "minadd" can pass 60, meaning 90min add (an hour half etc)

thanks,

        int minadd = convert.toint16(txtminadd.text);         datetime = datetime.now;         datetime nextevent = datetime.now.addminutes(minadd);         timespan diff = - nextevent;         if (diff > minadd) -------------- problem here         {             //act here         } 

edit: noted reed, code you've shown pretty pointless. assume want nextevent somewhere else.

i suspect want:

if (diff.totalminutes > minadd) { } 

or use:

timespan mintimespan = timespan.fromminutes(convert.toint16(txtminadd.text)); ... if (diff > mintimespan) { } 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -