int days = (int)t.TotalDays+1; // for casting to an integer
</syntaxhighlight>
=== How to sort objects based on DateTime.Now? ===
'''Scenario:''' Objects should be sorted by the current Date / Time value<br />
'''Prerequisites:''' classification CLS_SORTEDITEM
<syntaxhighlight lang="csharp">
this.ORDERID = 10000 - (DateTime.Now.Month*2678400 + DateTime.Now.Day*86400 + DateTime.Now.Hour*3600 + DateTime.Now.Minute*60 + DateTime.Now.Second);
</syntaxhighlight>
[[Category:Best Practices (internal)|Coding Practices]]
=== Actions should be executed for objects of a certain MetaClass ===