Timespan and datetime

Source: Internet
Author: User

<! -- Startfragment --> private void login_click (Object sender, system. eventargs E)
{
// The key as the unique identifier should be unique, which can be set as needed.
// For the test of Yu's cadmium, there is no rabbit, there is no vinegar, there is no gray, the call is very good? BR>
// Generate the key
String skey = username. Text + "_" + password. text;
// Obtain the value of the given key in the cache
String suser = convert. tostring (Cache [skey]);
// Check for existence
If (suser = NULL | suser = string. Empty)
{
// The project where the key is not found in the cache. The table name user is not logged on or has timed out.
// Note that the following method of using the timespan constructor to overload the version is the key to determining whether to log on.
Timespan sesstimeout = new timespan (0, 0, system. Web. httpcontext. Current. session. Timeout, 0 );
Httpcontext. Current. cache. insert (skey, skey, null, datetime. maxvalue, sesstimeout,
System. Web. caching. cacheitempriority. notremovable, null );
Session ["user"] = skey;
// Log on for the first time. You can do what you want.
MSG. Text = "<H4 style = 'color: red'> Hi! Welcome to <a href = 'HTTP: // DOTNET. aspx. CC/'> [wonderful world of the mengxian summit ]";
MSG. Text + = "</a>. Have a good time! :) </H4> ";
}
Else
{
// This user's record is found in the cache. The table name has been logged on and cannot be logged on again.
MSG. Text = "<H4 style = 'color: red'> sorry, you seem to have logged on:-(</H4> ";
Return;
}
}
 

Is the minute or the total minute of the difference ??

For example
2006-1-1 12:30:30
2006-1-1 11:31:30

The minute part is 1
The total number of minutes is 61.

Use timespan. Minutes or timespan. totalminutes

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.