0
 public JsonResult GetAll()
        {
            Entities contextObj = new Entities();
            var employeeList = contextObj.CCFFares.ToList();
            //return Json(employeeList, JsonRequestBehavior.AllowGet);

            return this.Json((from obj in contextObj.CCFFares
                              select new
                              {
                                  ID = obj.ID,
                                  Departure_Airport = obj.Departure_Airport,
                                  Destination = obj.Destination,
                                  Departure_Date = obj.Departure_Date.ToString(),
                                  Return_Date = obj.Return_Date.ToString(),
                                  Airline = obj.Airline,
                                  Fare = obj.Fare,
                                  Offer_Ends = obj.Offer_Ends,
                                  Ailine_Class = obj.Airline_Class
                              }), JsonRequestBehavior.AllowGet);
        }

I got an issue where i need to show the date in dd/mm/yy but i am receiving in this manner 2/20/2017 12:00:00 AM what i really dint want to and when i bind the value in view without to string conversion i do get the date time in this way " /Date(1479600000000)/ "where i need to show the date in dd/mm/yy simply can someone guide me on this please !

1
  • You can format the date using date filter Commented Dec 5, 2016 at 11:56

2 Answers 2

1

While binding to your html view use date filter as follows

{{your date in milliseconds| date:'dd/MM/yyyy'}}
Sign up to request clarification or add additional context in comments.

Comments

1

Keep .toString() as it is

Try by adding custom filter for date
Angular code

app.filter('filterDate', ['$filter', function ($filter) { 
 return function (input, format) {

     return (input) ? $filter('date')(input, format) : '';  
};

Your Html should be like

<li class="mark"> {{Departure_Date | filterDate : 'dd-MM-yy' }}</li>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.