How do I pass a datetime value as a URI parameter in asp.net mvc?

前端 未结 10 1099
孤城傲影
孤城傲影 2020-12-04 18:58

I need to have an action parameter that has a datetime value? Is there a standard way to do this? I need to have something like:

mysite/Controller/Action/2         


        
10条回答
  •  误落风尘
    2020-12-04 19:32

    Use the ticks value. It's quite simple to rebuild into a DateTime structure

     Int64 nTicks = DateTime.Now.Ticks;
     ....
     DateTime dtTime = new DateTime(nTicks);
    

提交回复
热议问题