Загрузка...

Why Your PHP Dates Keep Breaking

Why Your PHP Dates Keep Breaking (And How to Fix It) Ever spent hours debugging mysterious date bugs in your PHP code? You're probably using DateTime when you should be using DateTimeImmutable. In this quick tutorial, I'll show you the common DateTime mistake that breaks beginners' code and how to fix it in 60 seconds.

What You'll Learn:
Why DateTime causes unexpected bugs
How DateTimeImmutable prevents date mutation issues

00:00 Intro
01:13 The Problem with DateTime
01:49 DateTimeImmutable to the Rescue
02:19 Working with Timezones
03:38 Using DatePeriod for Date Ranges
04:55 Creating an AppDateTime Class
05:30 What You Need To Know
05:57 Outro
Links:
Our Discord - https://discord.gg/aMTxunVx
Buy our shirts - https://store.phparch.com/products/community-corner-podcast-t-shirt

Scott's Social Media:
Website - https://scott.keck-warren.com/
Bluesky - https://bsky.app/profile/scottkeckwarren.bsky.social
LinkedIn - https://www.linkedin.com/in/scott-keck-warren-91689810/
Mastodon - https://phpc.social/@scottkeckwarren
PHP Architect Social Media:

X: https://x.com/phparch
Mastodon: https://phparch.social/@phparch
Bluesky: https://bsky.app/profile/phparch.com
Discord: https://discord.phparch.com

Subscribe to our magazine: https://www.phparch.com/subscribe/

This podcast is made a little better thanks to our partners.

Displace
Infrastructure Management, Simplified
Automate Kubernetes deployments across any cloud provider or bare metal with a single command. Deploy, manage, and scale your infrastructure with ease.
https://displace.tech/

PHPScore
Put Your Technical Debt on Autopay with PHPScore
https://phpscore.com/

Honeybadger.io
Honeybadger helps you deploy with confidence and be your team’s DevOps hero by combining error, uptime, and performance monitoring in one simple platform. Check it out at honeybadger.io

Music Provided by Epidemic Sound https://www.epidemicsound.com/

Видео Why Your PHP Dates Keep Breaking канала PHP Architect
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять