How to calculate Mother's Day and Father's Day with PHP

Josh Sherman
1 min read
Software Development PHP

A little late on the Mother’s Day part, but since today is Father’s Day, I figured it would be fun to discuss how to obtain the dates for these moving holidays. To do so, all we need to use is use strtotime and tell it when the holiday will occur as well as the year that we want to get the holiday in.

Mother’s Day

Mother’s Day in the United States is held annually on the second Sunday of May.

echo date('Y-m-d', strtotime('second Sunday of May 2014'));

Father’s Day

Father’s Day in the United States is held annually on the third Sunday of June.

echo date('Y-m-d', strtotime('third Sunday of June 2014'));

That’s all there is to it! Happy Father’s Day to all my fellow dads out there, and happy belated Mother’s Day to all the ladies!

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles