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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:37:38+00:00 2026-05-24T18:37:38+00:00

Why is this returning the 31st instead of the 1st ? As I understand

  • 0

Why is this returning the 31st instead of the 1st? As I understand it, the UTC method requires 3 parameters ( full year, month, day ), and the day parameter must be an integer between 1 – 31. Because getDate() returns with an integer between 0 and 31, I also suspected 0 would be a possibility.

firstDay = new Date(Date.UTC( 2011 , 7 , 1 )).getDate(); 
// returns 31 (last day of this month)

Let me clarify and say, this is not a special case. With the day parameter as 2, 3, or 4, this will return 1, 2, 3, and so on.

  • 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-24T18:37:40+00:00Added an answer on May 24, 2026 at 6:37 pm

    Your timezone offset is negative so like -4. So 7/1/2011 at 12:00AM minus 4 hours is 6/31/2011 8:00PM. Date.UTC takes additional parameters that you can use to pass hours, minutes, seconds, and milliseconds.

    But really, if you don’t want the timezone adjustment use new Date(year, month, day)

    firstDay = new Date(2011 , 7 , 1).getDate(); // returns 1 (first day of this month)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say instead of returning void a method you returned a reference to the class
I looked at this: Returning values from nested functions in Javascript but it did
The below conditional (if) statement is returning this browser error: Uncaught TypeError: Object 46
I can't figure out why this is returning both occurrences of the string /Most
One of my tables in my SQLite database is returning this error code below:
When I serialize an object which has a DateTime in it this is returning
This statement is returning error 00920- invalid relational operator. I am sure it is
Anyone know why this is not returning a value? Example $item2['data'] where it =
This seems to be returning the correct answer, but I'm not sure if this
This Code: Something = new Guid() is returning: 00000000-0000-0000-0000-000000000000 all the time and I

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.