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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:22:30+00:00 2026-06-11T19:22:30+00:00

My js code is as follows:- var earlierdate=new Date(2012,09,22); alert(earlierdate.getDay()); var date2 = new

  • 0

My js code is as follows:-

   var earlierdate=new Date(2012,09,22);
   alert(earlierdate.getDay());

   var date2 = new Date('2012,09,22');
   alert(date2.getDay());

The problem is first alert gives me 1 0r Monday(which is incorrect) and second one gives me 6 or sat which is correct. So date given in quotes is giving correct result. Now if want to use variables instead of hard-coded values like

var date1 = new Date(a,b,c);
alert(date1.getDay());

What should be the syntax. I have tried a lot of variations but failed.

Thanks in advance.

  • 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-11T19:22:31+00:00Added an answer on June 11, 2026 at 7:22 pm

    The month parameter of Date is 0-indexed.

    month

    Integer value representing the month, beginning with 0 for January to
    11 for December.

    So if you mean September, that should be var earlierdate=new Date(2012, 8, 22);

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

Sidebar

Related Questions

My code looks like follows var html = $(el).html().toString(); html = '2012-05-10'; var re
My code that I tried is as follows: var dataO = new Object(); dataO.numberId
I have problem with xhr open() method. My code follows : var xmlhttp=false; if(!xmlhttp)
I've got code as follows: var smtpClient = new SmtpClient(my.mail.server); smtpClient.Send(mailmessage); however the send
I have a piece of javascript code as follows: var data = { ...
I have code as follows: $(#item_select).change(function() { var params = $(#item_select option:selected).val(); $.post('/account/ar_form.php', {idata:
My JavaScript code is as follows: $(document).keydown(function(event){ var move, inter; clearInterval(inter); inter = setInterval(move
My code is as follows: <script> var i = 2; $(document).ready(function(){ $(#newrow).click(function(){ $(#maintable).append('<tr> <td><input
I have some code as follows var MyObjectInstance = httpContext.Items[key] as MyObject What overhead
my json string is as follows: var data = [{first:3,second:1},{first:5,second:5},{first:7,second:1}]; Now i am calling

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.