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
Post a Comment