2

Is there a way in which you can auto increment a number each year.

For example: You have a business that started in 2010 and you have a line on the site that says "we have 11 years of experience" (as of 2021).

Is there a way to auto increment that number to 12 years when we go into 2022?

1
  • 1
    you can use PHP or JavaScript to get the current year, and then subtract 2010 from current year value. Commented Apr 17, 2021 at 12:45

1 Answer 1

2

Bootstrap doesn't offer this feature, but you can do something similar to this using javascript:

we have
<script>document.write(new Date().getFullYear() - 2010)</script>
years of experience

Sign up to request clarification or add additional context in comments.

1 Comment

You can remove the Date.now() since it new Date() would take current date by default. The statement can be written as document.write( (new Date()).getFullYear()) - 2010)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.