What is the difference between Minutes and TotalMinutes?

Source: Internet
Author: User

What is the difference between Minutes and TotalMinutes?

A bug was raised during the test today, saying that the message reminder time is incorrect. The setting is two hours ahead of schedule, and the notification is sent before it arrives.

Read the code

(m.ExpectReceiveTime - DateTime.Now).Minutes < (pModel.ErtDelayPrevMinutes == -999 ? 0 : pModel.ErtDelayPrevMinutes))                          

 

Run

(m.ExpectReceiveTime - DateTime.Now).Minutes

The result is 55, which is 170.

 

Run

(m.ExpectReceiveTime - DateTime.Now).TotalMinutes

Result 169.89568451

 

Finally, change the code

(Convert.ToDecimal((m.ExpectReceiveTime - DateTime.Now).TotalMinutes) < (pModel.ErtDelayPrevMinutes == -999 ? 0 : pModel.ErtDelayPrevMinutes))

BUG solving

 

Summary:

1. Minutes calculation is limited to Minutes, Int type, (-59 to 59)

Https://msdn.microsoft.com/zh-cn/library/vs/alm/system.timespan.minutes/css

 

2. TotalMinutes is calculated as the number of minutes of the entire time, double type.

Https://msdn.microsoft.com/zh-cn/library/vs/alm/system.timespan.totalminutes/css

 

Supplement:

Days; // Day Part Hours; // Hour Part

Milliseconds; // millisecond part

Minutes; // parts

Seconds; // Seconds

Ticks; // total number of Tick

TotalDays; // Total Number of days

TotalHours; // total hours

TotalMilliseconds; // The total number of milliseconds

TotalMinutes; // The total number of minutes

TotalSeconds; // The total number of seconds.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.