The 544 fiscal calendar used by Apple

Since 1999, the Saturday closest to the end of September is designated as the last day of Apple's fiscal year. For instance, 28 September 2024 (Saturday) is 2 days from 30 September 2024 and therefore it is the last day of Apple fiscal year 2024.

Apple fiscal year, \(y\) Start, \(\alpha\) End, \(\omega\) \(\Omega'\)
1994 2 October 1993 30 September 1994 (Fri)
1995 1 October 1994 29 September 1995 (Fri)
1996 30 September 1995 27 September 1996 (Fri)
1997 28 September 1998 26 September 1997 (Fri)
1998 27 September 1998 25 September 1998 (Fri)
1999 26 September 1998 25 September 1999 5
2000 26 September 1999 30 September 2000 0
2001 1 October 2000 29 September 2001 1
2002 30 September 2001 28 September 2002 2
2003 29 September 2002 27 September 2003 3
2004 28 September 2003 25 September 2004 5
2005 26 September 2004 24 September 2005 6
2006 25 September 2005 30 September 2006 0
2007 1 October 2006 29 September 2007 1
2008 30 September 2007 27 September 2008 0
2009 28 September 2008 26 September 2009 4
2010 27 September 2009 25 September 2010 5
2011 26 September 2010 24 September 2011 6
2012 25 September 2011 29 September 2012 1
2013 30 September 2012 28 September 2013 2
2014 29 September 2013 27 September 2014 3
2015 28 September 2014 26 September 2015 4
2016 27 September 2015 24 September 2016 6
2017 25 September 2016 30 September 2017 0
2018 1 October 2017 29 September 2018 1
2019 30 September 2018 28 September 2019 2
2020 29 September 2019 26 September 2020 4
2021 27 September 2020 25 September 2021 5
2022 26 September 2021 24 September 2022 6
2023 25 September 2022 30 September 2023 0
2024 1 October 2023 28 September 2024 2

An easy numerical scheme to compute the last day of Apple's fiscal year is to start with September 30, and then offset it by a couple of days to reduce its day of week value to Saturday.

\begin{equation} \omega(y) = \Omega(y) - \Omega'(y) \end{equation}

where \(\Omega(y)\) = 30 September and the amount of offset, \(\Omega'(y)\) is simply:

\begin{equation} \Omega'(y) = {\rm wday}(\Omega) \; {\rm mod} \; 7 \end{equation}

The first day, on the other hand, can be expressed very easily in terms of \(\omega\), since we can take it as the previous fiscal end point plus 1 day:

\begin{equation} \alpha(y) = \omega(y - 1) + 1 \end{equation}

The fiscal year \(y(date)\) associated with a given \(date\) can be computed from

\begin{equation} y = \begin{cases} Y + 1 & \textrm{if $date > \omega(Y)$}\\ Y - 1 & \textrm{if $date < \alpha(Y)$}\\ Y & \textrm{otherwise} \end{cases} \end{equation}

where \(Y(date)\) is the Gregorian year associated with the \(date\).

The calendrical distance of a given \(date\), \(\lambda\), displaced from the fiscal inception, \(\alpha(y)\), is then

\begin{equation} \lambda = date - \alpha(y) \end{equation}

Since a full 400-year Gregorian calendar has 146,097 days or 20,871 weeks, there are 71 extra weeks to be spread out in 400 years, that is

\begin{equation} \frac{400}{\frac{146097}{7} - 52 \times 400} = 5\tfrac{45}{71} = 5.63\ldots \end{equation}

As a result, a 53rd week is added to the third fiscal period (December) of a fiscal year every 5 or 6 years. A simple way to see if a given year is a 52-week year or a 53-week year is by computing the number of days between \(\alpha(y)\) and \(\omega(y)\), that is,

\begin{equation} \mathbb{Q}_\textrm{53 weeks?}(y) = \begin{cases} \small{\rm TRUE} & \textrm{if $\omega(y) - \alpha(y) + 1 = 53\times 7$}\\ \small{\rm FALSE} & \textrm{otherwise} \end{cases} \end{equation}

library(tidyverse)

fiscal_end <- function(.year) {
  
  .end <- paste0(.year, '-9-30') %>% as_date

  .end - days(wday(.end) %% 7)
}

fiscal_start <- function(.year) {
  
  fiscal_end(.year - 1) + days(1)
}

fiscal_distance <- function(.date) {
  
  .date <- as_date(.date)
  
  y <- year(.date)
  
  if(.date > fiscal_end(y)) {
    y <- y + 1
  } else if(.date < fiscal_start(y)) {
    y <- y - 1
  }
  
  as.numeric(
    .date - fiscal_start(y)
  )
}

fiscal_year_with_53_weeks <- function(.year) {
  
  fiscal_end(.year) - fiscal_start(.year) + 1 == 53 * 7
}




The number of work week accumulated at the end of a given period in a given fiscal year can be calculated by

\begin{equation} N(P) = 4(P+2) + \left\lfloor \tfrac{P+2}{3}\right\rfloor - q \end{equation}

where the value of \(q\) is determined by

\begin{equation} q = \begin{cases} 2^3 & \textrm{if $\mathbb{Q}_\textrm{53 weeks?}(y)$ is $\small{\rm FALSE}$ or $P \in [1, 3)$}\\ 2^3 - 1 & \textrm{otherwise} \end{cases} \end{equation}

For a given \(date\), the position of the work week can be calculated by discretizing \(\lambda\) in blocks of 7:

\begin{equation} W(date) = \left \lfloor \tfrac{1}{7}\lambda \right \rfloor + 1 \end{equation}

For a given \(date\), the position of the fiscal period can be calculated by:

\begin{equation} P(date) = \left \lceil \tfrac{3}{5+4+4} (W + q')\right \rceil - 2 \end{equation}

where the value of \(q'\) is determined by

\begin{equation} q' = \begin{cases} 2^3 & \textrm{if $\mathbb{Q}_\textrm{53 weeks?}(y)$ is $\small{\rm FALSE}$ or $W \in [1, 14)$}\\ 2^3 - 1 & \textrm{otherwise} \end{cases} \end{equation}

fiscal_cweek <- function(.year, .period) {
  
  with_53 <- fiscal_year_with_53_weeks(.year)
  
  q <- ifelse(.period %in% 1:2 | !with_53, 8, 7)
  
  .period <- .period + 2

  4 * .period + floor(.period / 3) - q
}

fiscal_nweek <- function(.year, .period) {
  
  fiscal_cweek(.year, .period) - 
    fiscal_cweek(.year, .period - 1)
}

fiscal_cweek_ <- function(.date) {
  
  lambda <- fiscal_distance(.date)
  
  floor(lambda / 7) + 1
}

fiscal_period_ <- function(.year, .cweek) {
  
  with_53 <- fiscal_year_with_53_weeks(.year)
  
  q <- ifelse(.cweek %in% 1:13 | !with_53, 8, 7)
  
  ceiling((.cweek + q) * 3/13) - 2
}

fiscal_period <- function(.date) {
  
  fiscal_cweek_(.date) %>% 
    fiscal_period_
}


Comments

Popular posts from this blog

「日上三竿」到底是早上多少點?

Urusan Seri Paduka Baginda和金牌急腳遞

The Sang Kancil Story of Malacca

《心經》裡面的「般若波羅蜜」一詞

有朋自遠方來,不亦樂乎?