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 4237410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:46:11+00:00 2026-05-21T02:46:11+00:00

Regardless of many posts I’ve read the magic still in my code. I have

  • 0

Regardless of many posts I’ve read the magic still in my code.
I have DateTime value in db (‘2011-03-30 00:00:00.000’) that I retrieve for asp.net/mvc page where some javascript needs to read it and compare. The magic in the following:

<% 
DateTime unixTimeOffset = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime testDate = new DateTime(2011,03,30,0,0,0,0);
%>
<%= (testDate - unixTimeOffset).TotalMilliseconds %>
...

Last string of the code gives me this value: 1301443200000
When I try to read it in JavaScript I have:

val myDate = new Date(1301443200000);

And myDate is Tue Mar 29 2011 20:00:00 GMT-0400 (Eastern Daylight Time) {} But not a March 30th as it should be.

I understand it provides date referencing to local time, GMT-4 but what is the solution to get it independent?
Any ideas? 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-05-21T02:46:11+00:00Added an answer on May 21, 2026 at 2:46 am

    Your code is correct. The myDate variable holds the correct date since Tue Mar 29 2011 20:00:00 GMT-0400 is the same point in time as Wed Mar 30 2011 00:00:00 GMT+0000. My guess is that you see the former since that is your computers time zone. Use myDate.toUTCString() to see the date as UTC.

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

Sidebar

Related Questions

I have common code that I want in various events for our standard jqGrid
I'm working on a project that is to simulate many functions seen in Microsoft
I have a method that does something, and it puts a javascript method into
I am attempting to have a file upload page that allows for an arbitrary
I have a large group of text box's that need to be validated..used the
To index my website, I have a Ruby script that in turn generates a
I have this report that I generate in an aspx page. I would like
I have a Java application that parses pdf files in a directory and its
I have a scheduled task that runs a script on a regular basis (every
I have a UIImage that I'm instantiating using imageWithData: (the data is loaded from

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.