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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:04:05+00:00 2026-06-11T20:04:05+00:00

I am having problem using Date Object, when I try to parse unix-timestamp. example:

  • 0

I am having problem using Date Object, when I try to parse unix-timestamp.

example:

//I am receiving json data that contains Unix-Timestamp like 1348514100000

var unixTimestamp = data.timestamp; //1348514100000
var date = new Date(unixTimestamp);
console.log(date.getDay()); // is wrong..

and example 2:

var unixTimestamp = data.timestamp; //1348514100000
var date = new Date();
date = date.setDate(unixTimestamp);
console.log(date.getDay()); // still wrong..

I have tried to parse string-timestamp to convert int with

var intUT = parseInt(unixTimestamp);

but still not the correct date&time.. I have really no idea what to do. How can I get the correct date and time from this unix timestamp?

Thank you!

  • 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-11T20:04:06+00:00Added an answer on June 11, 2026 at 8:04 pm

    Your code is completely fine, the only issue might be with incorrect type. Trying this:

    new Date(+"1348514100000")
    

    gives me Mon Sep 24 2012 21:15:00 GMT+0200 (CEST), others reported Mon Sep 24 2012 14:15:00 GMT-0500 (CDT) and 12:15:00 GMT-0700 (PDT). According to http://www.epochconverter.com it is Mon, 24 Sep 2012 19:15:00 GMT.

    Note that all these dates represent exactly the same point in time. The time zone difference (and thus different hour) is only due to stupid Date.toString() implementation (mistake copied from Java language).

    The only portable and built-in way to deal with such dates is to either operate on epoch time (milliseconds) or use getUTC*() family of methods:

    new Date(+"1348514100000").getUTCHours()
    

    The code above will always return 19 (GMT time), irrespective to browser/OS time zone.

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

Sidebar

Related Questions

I have an Action Method that returns a JSON-serialized object. The problem I'm having
I'm having a problem using the sed substitution option that executes a command in
I'm having a problem with using this in js. I have a function that
Hey, I am having a problem deserializing base64 json back into the .net object
I'm having problem filtering an NSScrollViews contents using it's date column. I have an
I am having a problem using PHP's PDO object to prepare an update statement
I have a SQL Server table that contains some datetime data. I'm using a
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
I'm having a problem using UpdateModel(theModelToUpdate) causing concurrency issues. Basically whats happening is, there
I'm having a problem using deploy:deploy-file with snapshots I'd like some advice on please.

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.