c# - Work out minutes difference between dates -



c# - Work out minutes difference between dates -

i have next code:

datetime pickerdate = convert.todatetime(pickerwakeupdate.selecteddate); string enteredstr = pickerdate.toshortdatestring() + " " + textwakeuptime.text; string format = "dd/m/yyyy hh:mm"; datetime entereddate = datetime.parseexact(enteredstr, format, null);

the problem facing workout difference between set date , date , time now. value need provide me value of how many minutes there between dates.

i tried using:

datetime todaysdatetime = datetime.now; timespan span = entereddate.subtract(todaysdatetime); int totalmins = span.minutes;

but gave me wrong value 0 when value set 10 minutes ahead.

can help me solve this

thanks.

i think want span.totalminutes (i cant tell how many times has caught me out on timespan class!)

for reference

timespan.minutes - "gets minutes component of time interval represented current timespan structure."

timespan.totalminutes - "gets value of current timespan construction expressed in whole , fractional minutes."

c# datetime time date timespan

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -