Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:39:17+00:00 2026-06-14T17:39:17+00:00

In my MVC4 asp.net project, i am binding datetime from database to the view

  • 0

In my MVC4 asp.net project, i am binding datetime from database to the view using ajax,

Here is the ajax code,

      $.get(
        '/Child/GetFamilyMemberView', { familyid: hv },
        function (data) {
            var html = "";
            for (var i = 0; i < data.length; i++) {                 
                html += "<p>" + data[i].Family_Member_DateofBirth + "</p>";                 
            }
            $("#getfamilymember").append(html); 
       });

After binding the datetime value to view, i get output as,

/Date(1104517800000)/

Any ideas why this is happening?

Please help,

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:39:18+00:00Added an answer on June 14, 2026 at 5:39 pm

    that is happening because your ajax is passing the data in JSON.

    Use a function like this one to convert Json date to Javascript Date:

    function parseJsonDate(jsonDate) {
        var offset = new Date().getTimezoneOffset() * 60000;
        var parts = /\/Date\((-?\d+)([+-]\d{2})?(\d{2})?.*/.exec(jsonDate);
    
        if (parts[2] == undefined) 
          parts[2] = 0;
    
        if (parts[3] == undefined) 
          parts[3] = 0;
    
        return new Date(+parts[1] + offset + parts[2]*3600000 + parts[3]*60000);
    };
    

    Update: use this http://www.mattkruse.com/javascript/date/ to format the javascript Date to string.

    If you want to pass the date to string (mm/dd/yyyy):

    function formatDate(jsDate)
    {
       return jsDate.getMonth()+1 + "/" + jsDate.getDate() + "/" + jsDate.getYear();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a project from scratch. I'll be using asp .net mvc4
Using ASP.NET MVC4 with EF4.3 Running Enable-Migrations from PM Console System.Management.Automation.RuntimeException: The project 'MyProj'
I am working on a project ASP.net 4, MVC4(RC) using visual studio 11. I
I have a ASP.NET MVC4 project with HTML5 semantic markup enabled. When using @Html.EditorFor(m
Using ASP.NET MVC4 I have created a DelegatingHandler in a WebAPI project. I use
I just upgraded my project from ASP.NET MVC1.0 to ASP.NET MVC4.0 One thing that
I'm working on a new asp.net mvc4 project using Visual Studio 2011 beta and
After manually upgrading an ASP.NET MVC project to MVC4 using these instructions , how
I've recently added Breeze to a project using Knockout and ASP.NET MVC4. I really
I have a simple asp.net MVC4 / EF 4.1 project created with VS 2011,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.