控制器:
DateTime startDate = DateTime.Now;
ViewData["now"] = startDate.ToString();
ViewData["interval"] = interval.ToString();
startDate.AddMonths(interval);
ViewData["later"] = startDate.ToString();
看法:
Now: <%=ViewData["now"] %><br />
Later: <%=ViewData["later"] %><br />
Interval: <%=ViewData["interval"] %>
这产生:
Now: 10/2/2009 12:17:14 PM
Later: 10/2/2009 12:17:14 PM
Interval: 6