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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:32:40+00:00 2026-06-03T22:32:40+00:00

I am trying to get future and past dates programatically based on the current

  • 0

I am trying to get future and past dates programatically based on the current time. I am not sure if I am just dumb or I am truly doing something wrong. So I have 2 questions

Does Node.js or the V8 engine have getMinutes, getMonth, etc… in it? I ask because when I try them I get a has no method errors for each of them with regards to a Date object?

Second question is: is there a resource I have missed on how to deal with dates in Node/V8 that I have just missed somewhere?

At the end of the day I am trying to get a date object that is from an hour ago and an hour into the future. Also 5 minutes ago and 5 minutes in the future. It doesn’t seem like it should be that hard, but I have been spinning my wheels for a couple of hours now.

Also do it without a 3rd party javascript module.

Here is one, of many, attempt with little luck:

var d1 = Date();
console.log(d1);
console.log(d1.getMonth());

error:

TypeError: Object Sun May 13 2012 20:28:01 GMT-0500 (CDT) has no method 'getMonth'

Another example this time from REPL: (Should this not be “march 3 2012 at 3:03:03”)?

d1 = new Date(2012,3,3,3,3,3)
> Tue, 03 Apr 2012 08:03:03 GMT
  • 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-03T22:32:42+00:00Added an answer on June 3, 2026 at 10:32 pm

    When the Date constructor is called as a function, it returns a string, not a date object. Change your code to:

    var d1 = new Date();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement Future.get(long, TimeUnit) in terms of TimeUnit.timedWait(Object, long) . It's not
I'm trying to get my Android tests running on headless emulator for future use
I'm trying to get a current web application running on my local machine, for
I am trying to find documentation indicating if java.util.concurrent.Future is/is not threadsafe. Eg can
I am stuck here with Linq query... I am just trying to get my
I am trying to do calculate days between 2 dates as follow: Obtain current
I am trying get all html links within a string and replace them using
I am trying get all html links within a string and replace them using
I am trying get Struts 2 and Tiles to work and I am using
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,

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.