How To Calculate “Year Since” Via JQuery

If you’re building a WordPress website and find you need to calculate “year since” via jQuery, the following is an ideal code for that.

An example can be found here:

Note: You may need to replace $ with jQuery if using within WordPress.

function yearsSince() {
var d = new Date();
var sinceThen = d.getFullYear()-1979;
$(document).ready(function() {
1979 is <span id="sinceDate">35+</span> years today.
Google Rating
Get a Quote