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

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -