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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:12:05+00:00 2026-06-03T09:12:05+00:00

Am I implementing setUTCMilliseconds incorrectly? I get the incorrect date for any value I

  • 0

Am I implementing setUTCMilliseconds incorrectly? I get the incorrect date for any value I put in. Here is just one example of a wrong value. All my test data resolves to May 24 (the future from now) in JS, but in C# or using quick online conversion tools, my UTS MS are correct.

any thoughts?

function parseDate(epoch) {   
    var d = new Date();

    //tried this too, but it shows me the actual epoch 1970 date instead
    //var d = new Date(0);

    //EDIT: this should be seconds in combination with Date(0)
    d.setUTCMilliseconds(parseInt(epoch)); 

    return d.toString();
}

 // 1336423503 -> Should be Mon May 07 2012 13:45:03 GMT-7

 // javascript says
 Thu May 24 2012 05:03:21 GMT-0700 (Pacific Daylight Time) 
  • 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-03T09:12:06+00:00Added an answer on June 3, 2026 at 9:12 am

    From a similar question:

    var utcMilliseconds = 1234567890000;
    var d = new Date(0); // The 0 there is the key, which sets the date to the epoch
    d.setUTCMilliseconds(utcMilliseconds);
    

    See Convert UTC Epoch to local date with javascript.

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

Sidebar

Related Questions

When implementing the Strategy Pattern, where does one put the code that determines which
When implementing a class, is it better practice to return a value for methods
Implementing the very first scala example I ran into some problems probably tipical for
Implementing a low pass FIR filter, when should one use FFT and IFFT instead
Im implementing a pool billiard game in Java and it all works fine. It
When implementing iterator using yield return , is there any difference between returning IEnumerator
When implementing move constructors and move assignment operators, one often writes code like this:
Implementing/handling idempotency in c# with Jolivers EventStore. Does this mean just taking care of
When implementing Quicksort, one of the things you have to do is to choose
Implementing Interface just provide the skeleton of the method. If we know the exact

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.