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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:36:20+00:00 2026-05-23T03:36:20+00:00

I have a problem which can’t solve by myself. Here is timestamp 1308085200 taken

  • 0

I have a problem which can’t solve by myself.

Here is timestamp 1308085200 taken from my website database. It represents 2011-06-15 12:00:00

Here is javascript code which I use to “fetch” date in human readable format.

var date    = new Date(1308085200 * 1000);
var year    = date.getFullYear();
var month   = date.getMonth();
var day     = date.getDate();
var hour    = date.getUTCHours();
var minute  = date.getUTCMinutes();
var seconds = date.getUTCSeconds();

The problem is that I get wrong results. For example the code above shows 2011-5-15 21:0:0 instead of 2011-06-15 12:00:00

What I do wrong and how to fix that ?

  • 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-23T03:36:21+00:00Added an answer on May 23, 2026 at 3:36 am

    JavaScript’s Date::getMonth() returns a zero-based integer from 0 to 11 which is why your date is showing May instead of June.

    https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getMonth

    Update

    As for the time portion, this is what I get (AEST)

    var d = new Date(1308085200000); // Wed Jun 15 07:00:00 GMT+1000 (EST)
    d.toUTCString() // Tue, 14 Jun 2011 21:00:00 GMT
    d.getUTCFullYear() // 2011
    d.getUTCMonth() // 5
    d.getUTCDate() // 14
    d.getUTCHours() // 21
    d.getUTCMinutes() // 0
    d.getUTCSeconds() // 0
    

    Looks like your timestamp is actually not what you think it is.

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

Sidebar

Related Questions

I have a small problem which i can't seem to solve myself. Look at
Here is my problem : I have a list of messages which I can
I have a problem which I'm pretty sure that I can't solve without going
My Problem I have a Problem which i can not solve my self. I
I have a problem which I can not solve. If this query is answered
Here I have a problem which I can't get over with. This is the
I have a problem which i can't seem to find the solution to. I
I have a small problem which i can't seem to figure out. I tried
I have a strange problem which I can't fix: A field: private boolean[][][] gaps;
I have some problem with my open new window popup which it can read

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.