Better to consider server date, in your case when user clicks on Action Link Controller-Action will be called and in side same action just take the Server Date with DateTime.Now. Try to avoid client side date generation as much as you can.
how to pass todays date in the url/session?
-
27-06-2022 - |
Question
So in the view if the user is currently logged in 'Book Now' appears, which navigates them to 'Availability' controller / 'Index' function. I want to pass todays date as a session?
any ideas? thanks Note: using orchard 1.6
@if(WorkContext.CurrentUser != null)
{
@Html.ActionLink(T("Book Now").Text, "Index", new { Controller = "Availability", Area = "Project0120" })
}
EDIT I am trying ti display a list of bookings for a month. Originally I set the loop to 30, for a default. Now that I have the code inside the loop working. i only want to run through the loop how many days are in this month...so i was trying
var dateAsString = DateTime.Now.ToString("dd-MM-yyyy"); to get todays date, then I wanted to use the days as the maximum in the loop
for (int i = 1; i <= dateAsString.?getdays?; i ++)
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow