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

  • Home
  • SEARCH
  • 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 8527479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:34:07+00:00 2026-06-11T08:34:07+00:00

I have following code var res = from c in model.Data select new object[]

  • 0

I have following code

  var res = from c in model.Data 
            select new object[] { c.Id, c.Time, c.Name };

this res variable is sent as json object.

Time is DateTime property.
I’m fetching this json objects in the view like following

$(document).ready(function () {

        $('#myDataTable').dataTable({
            "bServerSide": true,
            "sAjaxSource": "/Home/AjaxHandler",
            "bProcessing": true,
            "aoColumns": [
                        { "sName": "ID",
                            "bSearchable": false,
                            "bSortable": false,
                            "fnRender": function (oObj) {
                                return '<a href=\"Details/' +
                                oObj.aData[0] + '\">View</a>';
                            }
                        },
                        { "sName": "Time" },
                        { "sName": "Name" }
                    ]
        });
    });

Page is rendered with datetime fields like /Date(1346996934000)/

What is the best way to convert this, on the server side or in the view and how to do this?

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-11T08:34:08+00:00Added an answer on June 11, 2026 at 8:34 am

    Is that number the date in ticks? If that’s the case, then

    DateTime date = new DateTime(long.Parse(1346996934000));
    

    Found that here: Format from ticks to date

    This would be converted to: Fri Sep 07 2012 01:48:54 in GMT-4 timezone.

    This is a solution I for doing it in JavaScript, found here: http://deekshadev.blogspot.com/2011/03/convert-ticks-to-date-object.html

    //convert the event day to a date object
    var startticks = new Date(ticks * 1000);
    
    //convert today to ticks will be in milliseconds
    var todayticks = new Date().getTime();
    
    var diff = startticks - todayticks;
    var days = Math.floor(diff/(24*60*60*1000));
    var hours = (diff/(60*60*1000)) % 24;
    var mins = (diff/(60*1000)) % 60;
    Here ticks was in seconds, so multiplying it with 1000 to convert to milliseconds.
    

    If that date is only needed for display, I wouldn’t do it on the server level. I’d convert on the client and display it as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: var resultArticles = from a in articleItems select new
I have the following code: initialize: function() { _.bindAll(this); var callBack = function(res) {
I have the following code: var carsContext = new CarsDataContext(); IQueryable<Car> allCars = carsContext.Cars;
I have the following code: var tlp = new TableLayoutPanel { Location = new
I have the following code to insert data into DB - this code has
I have the following code: var tagToPosts = (from t2p in dataContext.TagToPosts join t
I have the following code: var devices = from d in ctx.Devices.Include(DeviceGroups) where d.DeviceEnabled
I have the following code: var request = new GeocodingRequest(); request.Address = postcode; request.Sensor
I have the following code: var submitHandler = function ($link, $form, close) { var
I have the following code: var refreshId = setInterval(function() { $(#footad).html('myjshere'); }, 15500); Where

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.