Click here to Skip to main content
15,567,786 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want to show only the date, I try like this;


this is are C# properties:

public JsonResult GetDiarySummary(double start, double end, string Title)
            var ApptListForDate = DiaryEvent.LoadAppointmentSummaryInDateRange(start, end, Title);
            var eventList = from e in ApptListForDate
                            select new
                                id = e.ID,
                                title = e.Title,
                                appointmentLength = e.AppointmentLength,
                                start = e.StartDateString.FormatWith("MM/dd/yy"),
                                scheduledTime = e.StartDateString,
                                end = e.EndDateString,
                                someKey = e.SomeImportantKeyID,
                                allDay = false
            var rows = eventList.ToArray();
            return Json(rows, JsonRequestBehavior.AllowGet);
Updated 30-Jan-15 9:05am
ZurdoDev 30-Jan-15 13:48pm    
.toString() in JavaScript, as I recall, does not support passing date format strings.
Anurag Gandhi 30-Jan-15 13:57pm    
Are you looking for removing time part from DateTime string?
.val() returns string, not date varialbe. so, you are applying toString on string variable.
Try something like:
value.replace(/\d{1,2}:\d{2}(AM|PM)/ig, '');
to remove time part.
[no name] 30-Jan-15 14:04pm    
Thank you, but like this:

$("#popupEventForm").find("form").find("#eventDate").val(calEvent.start).replaceWith(/\d{1,2}:\d{2}(AM|PM)/ig, '');

because: value.replace doesnt exist
Sinisa Hajnal 31-Jan-15 2:40am    
Use moment.js, Date.js or some other library that enables you to format dates.
[no name] 31-Jan-15 6:45am    
Ok, thank you

1 solution

I solved, like this:

rec.StartDateString = item.DateTimeScheduled.ToString("MMMM/dd/yyyy");
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900