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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:47:21+00:00 2026-06-04T07:47:21+00:00

Am rediscovering HTML after quite some time. I am using just HTML and javascript

  • 0

Am rediscovering HTML after quite some time.

I am using just HTML and javascript along with Salesforce. I have two date input fields.
I was curious to see if there is any easy way to populate these fields with:
a. Today’s date
b. Date 6 months before today.

<input type="text" id="toDate" size="10" onmouseover="initialiseCalendar(this, 'toDate')"/> 

Thanks,
Calvin

  • 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-04T07:47:23+00:00Added an answer on June 4, 2026 at 7:47 am

    Populate with today’s date:

    var today = new Date();
    document.getElementById("toDate").value = today.getFullYear() + "-"
            + String(today.getMonth() + 101).slice(-2) + "-"
            + String(today.getDate() + 100).slice(-2);
    

    6 month in the past:

    var past = new Date();
    past.setMonth(past.getMonth() - 6); //
    document.getElementById("toOldDate").value = past.getFullYear() + "-"
            + String(past.getMonth() + 101).slice(-2) + "-"
            + String(past.getDate() + 100).slice(-2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to implement these buttons at the moment: http://web.archive.org/web/20110721191046/http://particletree.com/features/rediscovering-the-button-element/ Can't decide which to
I have two vectors of floats and i want them to become one vector
I'm rediscovering Java, and I'm a little lost about how to do this within
I am currently rediscovering Java (working with Ruby a lot recently), and I love
What is the best way to do validation in MVC 3? Here are the
Appearance-wise, I am struggling to use CSS to create buttons for forms that will
As I'm riding the wave of resurgence of Smalltalk (especially because many Ruby-on-Rails people
In migrating to CRM 2011, we're discovering different developers used different capitalization of custom
I've created a Java application that parses a text file to extract fields that

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.