简体   繁体   中英

Time delay for DateTime.Now value

I wrote the method in controller like,

public ContentResult GetServerTime()
{
   return Content(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString());
}

I need to set the time delay for the return value is it possible? I am new to MVC.

正如Athiban所说,Thread.Sleep(1000)会将响应延迟1秒钟。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM