Pacific Database

Home | Contact | FAQs | View Cart

A world of information at your fingertips

Date & Time :: Quarter functions

On this page you will find several functions for calculating quarter-related dates.

First day of the quarter

    myDate = DateSerial(Year(dte), Int((Month(dte) - 1) / 3) * 3 + 1, 1)

Last day of the quarter

    myDate = DateSerial(Year(dte), Int((Month(dte) + 2) / 3) * 3 + 1, 0)

First Friday in the quarter

    myDate = DateSerial(Year(dte), Int((Month(dte) - 1) / 3) * 3 + 1, 1) + _
		Choose(WeekDay(DateSerial(Year(dte), Int((Month(dte) - 1) / 3) * 3 + 1, 1), _
		vbFriday),0,6,5,4,3,2,1)

Last Friday in the quarter

    myDate = DateSerial(Year(dte), Int((Month(dte) + 2) / 3) * 3 + 1, 0) - _
		Choose(WeekDay(DateSerial(Year(dte), Int((Month(dte) + 2) / 3) * 3 + 1, 0), _
		vbFriday),0,1,2,3,4,5,6)