PHP’s date and strftime functions are great for retreiving date-related info formatting them. The only thing missing is a way to determine the quarter (Q1-Q4) for a timestamp. Here’s a very short function that will return the quarter for a timestamp:

/**
 * Return the quarter for a timestamp.
 * @returns More >