I want to fetch browser date automatically on a page,
The controller code is as follows:-
HttpCookie myCookies = Request.Cookies["MemberID"];
int memberid = int.Parse(myCookies.Value);
var notes = data.Notes.ByCreatedBy(memberid);
return View(notes);
Now in the View, I am displaying values as The notes of current date only should get displayed:-
if (@DateTime.Now.Day == item.CreatedOn.Value.Day && @DateTime.Now.Month == item.CreatedOn.Value.Month && @DateTime.Now.Year == item.CreatedOn.Value.Year)
{
<li class="track_notes_li" id='@item.NoteID'><a href="/Notes/Index/@item.NoteID"><span class="first_word">@item.Description,</span> <span>@item.CreatedOn.Value.ToShortDateString()</span></a></li>
}
The problem is , the date it is taking in DateTime.Now is the date of the server. So I will get issues when timezone is different. I want to know how to get the browser date so that the current day notes irrespective of timezones should get displayed.