Simple way to display "years of service" in html/javascript

I am trying to display a number for years of service on a website. Essentially I thought I could put in a start date and current date to have an output of the years in between.

I can gt the current year using the following code but am unsure how to calculate the deference

<script>document.write(2010)+(/\d{4}/.exec(Date())[0])</script>


from Recent Questions - Stack Overflow https://ift.tt/3wqmuzd
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Hibernate Search - Elasticsearch with JSON manipulation

Today Walkin 14th-Sept

Spring Elasticsearch Operations