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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:37:04+00:00 2026-05-26T22:37:04+00:00

I want user to enter a date. Using a form, and in the background

  • 0

I want user to enter a date. Using a form, and in the background convert this to number of days. Then desuct a certain number of days, then convert that back to a date.

Example:

Enter the date you were born.

— convert to xx amount of days (dateindays)

Then make newtotal=dateindays-280

convert newtotal to a date.

Can anyone point me in the right direction of doing this, or do they know some function for doing this?

So lets say :user enters date 13th July 1980
We use js to convert this to total number of days 11,453 days

Then create new function : subtotal=11453-280

And convert those number of days into a date, and echo back on screen.

  • 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-26T22:37:04+00:00Added an answer on May 26, 2026 at 10:37 pm
    var d1 = Date.parse("13 July 1980");
    d1 = d1 - 24192000000; // 280 days in milliseconds
    
    var newDate = new Date(d1);
    
    console.log(newDate); // will return a date object that represents Oct 07 1979
    

    Then use the following link to format it:
    http://www.webdevelopersnotes.com/tips/html/10_ways_to_format_time_and_date_using_javascript.php3

    Thanks to this SO question for the link:
    Where can I find documentation on formatting a date in JavaScript?

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

Sidebar

Related Questions

i want something like this the user enter a website link i need check
i am making a application in which user enter a date when he want
I want to compare the user's birthday against today's date and get the number
I have a form where a user need to enter date and time (2
I have a date input that requires the user to enter the date in
I have textarea in my site(link shortening site) i want to user enter some
Basically, I do not want the user to enter '0' (zero) as the first
I want to allow user to enter only english alphabets and characters. How can
I want to open a save file dialog, have the user enter a filename,
I want to build a site where the user can enter text and format

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.