{"id":356570,"date":"2021-11-18T07:38:51","date_gmt":"2021-11-18T15:38:51","guid":{"rendered":"https:\/\/css-tricks.com\/?p=356570"},"modified":"2022-01-05T12:58:16","modified_gmt":"2022-01-05T20:58:16","slug":"php-date-and-time-recipes","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/php-date-and-time-recipes\/","title":{"rendered":"PHP Date and Time Recipes"},"content":{"rendered":"\n
\n
\n

Dealing with dates and times is one of those things that can frustrate programmers a lot. At the same time, they are fundamental to software development, used from everything from meta and how things are ordered to time-based triggers and lots in between.<\/p>\n\n\n\n

Dates and times are prone to errors too. Handle them incorrectly, and they can confuse end-users and fellow programmers alike.<\/p>\n\n\n\n

This is a quick guide to dealing with dates and times specifically in the PHP programming language. It\u2019s meant to be a reference to the most common needs you\u2019ll have, like formatting and adjusting dates. It\u2019s simple, but it\u2019s likely going to cover 80% of your needs.<\/p>\n\n\n

Table of Contents<\/h2>