timeoffset in whole minutes in c#
<p>I have a method that calculates the number of minutes between two times. Something like this:</p>

<pre><code>DateTime UserLocalTime = DateTime.UtcNow.ConvertToUserTime(UserTimezoneID);

double TheOffset = (UserLocalTime - DateTime.UtcNow).TotalMinutes;

return TheOffset.ToString();
</code></pre>

<p>The problem is that it's returning something like 119.83723 because it's calculating minutes AND seconds and such.</p>

<p>How can I fix this? I'm afraid sometimes it'll also return 120.11233 so rounding might not totally help either.</p>

<p>Thanks for your suggestions.</p>

<p><em>Update1: (int)(Math.Round((UserLocalTime - DateTime.UtcNow).TotalMinutes)); returns 119.</em></p>

<p>Update2: I tried this, it looks like it works but will fail when the offset is weird (sometimes it might be 5:30 and the answer should be 330 minutes)</p>

<pre><code>int TheOffset = (int)(Math.Round((UserLocalTime - DateTime.UtcNow).TotalHours));
TheOffset = TheOffset * 60;
</code></pre>
