In the ASP. NET Framework, each HTTP request will automatically store the timestamp at runtime.You can useTimestampAttribute to obtain the datetime value of a datetime supported field.Here, I describe the httpcontext timestamp attribute and describe its details. The timestamp attribute does not read the current time. It can only read one datetime field and is automatically stored after each HTTP request.Therefore, using the timestamp attribute is much faster than using datetime. Now or any other method. An instance of the httpcontext type storing the timestamp attribute can quickly get the start time of a request to your website.Instead of accessing the system clock, it will return a automatically stored datetime value, which means only several bytes are copied to the memory, rather than any clock operation. Therefore,It is ideal for processing time-oriented requests with many requirements and timestamp attributes.
// Specific time:
Response. Write (context. timestamp. tostring () + " <Br> " );
// Year, month, and day:
Response. Write (context. timestamp. Date. tostring ( " D " ) + " <Br> " );
// Year:
Response. Write (context. timestamp. Year + " <Br> " );
// Month:
Response. Write (context. timestamp. Month + " <Br> " );
// Date:
Response. Write (context. timestamp. Date + " <Br> " );
// Date:
Response. Write (context. timestamp. Day + " <Br> " );
// Week:
Response. Write (context. timestamp. dayofweek + " <Br> " );
// The day of the year:
Response. Write (context. timestamp. dayofyear + " <Br> " );
// Hours:
Response. Write (context. timestamp. Hour + " <Br> " );
// Millisecond:
Response. Write (context. timestamp. millisecond + " <Br> " );
// Points:
Response. Write (context. timestamp. Minute + " <Br> " );
// Seconds:
Response. Write (context. timestamp. Second + " <Br> " );
PS: Actually, it is the datetime type.