SHARE
Facebook X Pinterest WhatsApp

Fiscal Date Calculation Script

Jun 28, 2002

Here’s a script I wrote for returning fiscal dates. We use the 4-4-5 calendar here at my work, and so my queries often have to reference date ranges that must fall at the start of the correct periods. Our 2002 fiscal calendar started on 9/30/01 and this is used as the offset for calculating all dates.

Basically, you pass this script a date and it will return the fiscal year and period, and also the MTD, YTD, and WTD dates comparable to the passed date. If your fiscal year begins on a different date, then it can be changed in the “Initialize Variables” section. I use SQL7 and it works fine, but I have not tested it on 6.5.

Author: Bill Abreu

Download Script:
sp_fiscal.txt



Disclaimer:
We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Recommended for you...

What Backups Do I Have?
Gregory Larsen
May 12, 2021
Improving the Performance of a Table Variable using Optimizer Hint RECOMPILE
Gregory Larsen
Apr 1, 2021
TYPE Definition Change in Oracle 21c
Tip 74 – Changing Cost Threshold for Parallelism
Gregory Larsen
Feb 24, 2021
Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.