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
    you can use [PHP](https://stackoverflow.com/questions/64003/how-do-i-use-php-to-get-the-current-year) or [JavaScript](https://stackoverflow.com/questions/6002254/get-the-current-year-in-javascript) to get the current year, and then subtract 2010 from current year value. – Debsmita Paul Apr 17 '21 at 12:45

1 Answers1

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
Drdilyor
  • 1,250
  • 1
  • 12
  • 30
  • 1
    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)` – Ajith Gopi Apr 17 '21 at 13:21