Apart from the standard datediff() and timestampdiff(), Vertica and MySQL offer a couple of more ways to go about it: By using the age functions: age_in_years (current date, start date) and age_in_months (current date, start date) A key thing to remember about these two is that, unlike datediff ('years', start date, current date), they will calculate the months/years between the … Continue reading How do I find the difference between two time periods?
Should you work for a public company, it is very likely that the fiscal year of your company may not be the same as the calendar year. This in turn, means, that a bunch of your analyses may need to forecast financials for the fiscal quarters, rather than the calendar ones. How could you then … Continue reading How do I calculate the remaining days until the end of a fiscal quarter?
It may sound overwhelming but it's actually quite simple, especially if you've already figured out how to: extract various time periods from a date get the end date of the current quarter calculate the number of days between two days As you'll see below - calculating the remaining days in current quarter is then nothing … Continue reading How do I calculate the remaining days until the end of a calendar quarter?
Whether you're: calculating key supply chain indicators trying to forecast orders/sales/revenue until the end of quarter/year, you're very likely to find yourself in the need of calculating the difference between two dates (timestamps)... A way to go about it would be to use the datediff('years', start date, current date) function. The great thing about the datediff() … Continue reading How do I find the difference between two dates with SQL?