;

How to Get a Financial Year or Fiscal Year Using a Given Date in Javascript


Tutorialsrack 26/11/2019 Javascript

In this article, we will learn how to get a financial year or fiscal year using a given date in Javascript.

Here is the code to get a financial year or fiscal year using a given date in Javascript.

Example - Get a financial year or fiscal year using a given date in Javascript
<script>
    function getCurrentFinancialYear() {
        var financial_year = "";
        var today = new Date();
        if ((today.getMonth() + 1) <= 3) {
            financial_year = (today.getFullYear() - 1) + "-" + today.getFullYear()
        } else {
            financial_year = today.getFullYear() + "-" + (today.getFullYear() + 1)
        }
        return financial_year;
    }
    alert(getCurrentFinancialYear());
</script>

I hope this article will help you to understand how to get a financial year using a given date in Javascript.

Share your valuable feedback, please post your comment at the bottom of this article. Thank you!


Related Posts



Comments

Recent Posts
Tags