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 an Oracle database with data in French language. My users mentionned that
I have this function: function start-sqlsnap { add-pssnapin SqlServerCmdletSnapin100 } Regardless of the method
How do I display the value associated with switch A and switch B regardless
I could have sworn I knew how to do this ... regardless, I want
Is there any good internet resource describing different practices for merging/branching regardless of source
The common solution to preventing deadlock in code is to make sure the sequence
My problem is similar to what this person has posted: http://groups.google.com/group/android-developers/browse_thread/thread/216839d1c45cefa9/a1b9517d2064726b?show_docid=a1b9517d2064726b That is, my
I'll do my best to describe what I'm trying to accomplish: Lets say for
UPDATE - I'm probably being daft, see my last update below. I just did
I am trying to schedule a build to be run at a scheduled time

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.