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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:16:50+00:00 2026-05-20T02:16:50+00:00

Why is the following expression invalid? var hello = new Date(2010, 11, 17, 0,

  • 0

Why is the following expression invalid?

var hello = new Date(2010, 11, 17, 0, 0, 0, 0);

For example, hello.UTC() doesn’t work.

  • 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-20T02:16:51+00:00Added an answer on May 20, 2026 at 2:16 am
    var hello = new Date(2010, 11, 17, 0, 0, 0, 0);
    console.log(hello.toUTCString());
    

    and

    var hello2 = Date.UTC(2010, 11, 17, 0, 0, 0, 0);
    console.log(hello2);
    

    These two are actually two different functions that print out different things.

    toUTCString() – Converts a Date object to a string, according to universal time

    where as

    Date.UTC() – returns the number of milliseconds in a date string since midnight of January 1, 1970, according to universal time.

    If you are attempting to calculate the milliseconds in a date string since midnight of 1-1-1970 then you will have to use Date.UTC();. However if you are attempting to get properties, in different forms, of the new Date(2010, 11, 17, 0, 0, 0, 0); then you’ll have to use its own constructor methods (toUTCString() or getUTCMilliseconds() and etc).

    UTC appears to be a member of the Date constructor itself, and not a member of Date instances. So, in order to invoke UTC you have to use Date.UTC(); Date() converts current time to a string, according to universal time and Date.UTC() retrieves and use value that is calculated in milliseconds from 01 January, 1970 00:00:00 Universal Time (UTC). So, they are like a ‘static’ functions.

    Moreover, in JavaScript whenever you use the 'new' keyword to create a new object (instantiate), the this value of the constructor points to the new Object. So, hello can have a date of its own as oppose to Date() or Date.UTC()‘s this would be pointing to a different scope (global i think) which would do its calculation based on 1-1-1970 00:00:00 or return the time which Date function is invoked. The Object hello, on the other hand, would have a base date which was instantiated with new Date(2010, 11, 17, 0, 0, 0, 0) with its set of constructed methods (toUTCString(); and etc). The new Date with this pointing to the new Object using the passed properties as the base “date” value.

    With all these being said, hello.UTC() is accessing a function that is not a member of its constructor and thus doesn’t work. This is part of the OOP in JavaScript. This is all on top of my head and probably a bit fuzzy if you are reading this. Please correct me if i have errors.

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

Sidebar

Related Questions

I'm very new in regular expression and I'm trying to validate date using following
In the following code: private static void Main(string[] args) { var listy = new
I have the following expression that should match the entire given word in case
I have the following expression within a report: = Switch( Fields!RATE_CODE.Value = First, £/Week,
I came across the following expression in someone else's code. I think it's terrible
I have found the following expression which is intended to modify the id of
I've the following expression in my report. =FormatNumber(MAX(Fields!Reading.Value, CellReading_Reading),3) Now when the dataset is
I am using the following Expression to select all hyperlinks //a[@href] How can I
How do i Evaluate the following expression from a string to a answer as
I am trying to search for files which matches following expression with sed [a-zA-Z0-9]{1,10}\s{1,5}\

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.