The PHP DateTime Class

Опубликовано: 07 Июль 2026
на канале: PHP Architect
1,180
30

In this video, Scott discusses the built-in PHP DateTime and DateTimeImmutable classes so you can use them in your project.

00:00 Intro
01:09 Creating
01:39 Formatting Dates
02:02 Creating From Formatted Dates
02:26 Adding and Subtracting Time
03:17 Cloudways
04:28 Comparing Two Dates
04:54 Timezones
05:19 DateTimeImmutable vs DateTime
05:39 Extending
06:09 Iterating Over A Date Range
06:29 Outro


php[architect] is an industry-leading publication focused on the PHP language. We are for developers written by developers. Publishing great PHP content since 2002 and dedicated to providing educational material to the PHP programming community.

Subscribe today at https://phpa.me/signup
Twitter: @phparch
Facebook: https://phpa.me/facebook
LinkedIn: https://phpa.me/linkedin

This video is sponsored by Cloudways
Cloudways offers peace of mind and flexibility so you can focus on growing your business instead of dealing with server management. With Cloudways, you get an optimized stack, managed servers, backups, staging environment, integrated Git, pre-configured, Composer, 24/7 support, and a choice of five cloud providers: AWS, DigitalOcean, Linode, Google Cloud, and Vultr.

Get a discount 20% for 3 months by using code "PHPARCH"

https://phparch.com/cloudways