date_create(): creates a new DateTime object

date_create in PHP class is available in PHP 5 and higher versions .
Today's date
$today   =  date_create('now');
echo $today->format('Y-m-d H:i:s');
The above example will display today's date and time in Year-month-date Hour:minutes:second format. Here is the output
2025-10-14 03:30:31
date_default_timezone_set('America/Chicago');
$today   = date_create('2019-05-29');
echo $today->format('Y-m-d H:i:s')
Output is here
2019-05-29 00:00:00
If you are getting warning message saying not to rely on system time zone , then add this line to the top.
date_default_timezone_set('America/Chicago');
$today = date_create('now');
echo $today->format('Y-m-d H:i:s');
Let us try tomorrow's date
date_default_timezone_set('America/Chicago');
$date = date_create("now");
echo $date->format('d-m-y H:i:s');
echo "<br><br>";
$date = date_create("tomorrow");
echo $date->format('d-m-y H:i:s');
Out put is here
13-10-25 22:30:31

14-10-25 00:00:00
Another way
date_default_timezone_set('America/Chicago');
$date = date_create('2013-07-19 23:16:30');
echo $date->format('Y-m-d H:i:s') ;
Output is here
2013-07-19 23:16:30
Code Output
$d = date_create('now');
echo $d->format('Y-m-d') ;
2025-10-13
$d = date_create('19 July 2018');
echo $d->format('Y-m-d') ;
2018-07-19
$d = date_create('Tomorrow');
echo $d->format('Y-m-d') ;
2025-10-14
$d = date_create('Yesterday');
echo $d->format('Y-m-d') ;
2025-10-12
$d = date_create('+1 day');
echo $d->format('Y-m-d') ;
2025-10-14
$d = date_create('+1 week');
echo $d->format('Y-m-d') ;
2025-10-20
$d = date_create('+1 week 5 days');
echo $d->format('Y-m-d') ;
2025-10-25
$d = date_create('+1 month');
echo $d->format('Y-m-d') ;
2025-11-13
$d = date_create('+1 month 10 days');
echo $d->format('Y-m-d') ;
2025-11-23
$d = date_create('+3 months -1 day');
echo $d->format('Y-m-d') ;
2026-01-12
$d = date_create('+3 years');
echo $d->format('Y-m-d') ;
2028-10-13
$d = date_create('+1 year 5 days');
echo $d->format('Y-m-d') ;
2026-10-18
$d = date_create('Monday');
echo $d->format('Y-m-d') ;
2025-10-13
$d = date_create('Monday +1 day ');
echo $d->format('Y-m-d') ;
2025-10-14
$d = date_create('first day of this month');
echo $d->format('Y-m-d') ;
2025-10-01
$d = date_create('last day of this month');
echo $d->format('Y-m-d') ;
2025-10-31
$d = date_create('first day of previous month');
echo $d->format('Y-m-d') ;
2025-09-01
$d = date_create('last day of previous month');
echo $d->format('Y-m-d') ;
2025-09-30
$d = date_create('first day of next month');
echo $d->format('Y-m-d') ;
2025-11-01
$d = date_create('last day of next month');
echo $d->format('Y-m-d') ;
2025-11-30
$d = date_create('last day of next month +1 hour');
echo $d->format('Y-m-d : H:i:s') ;
2025-11-30 : 23:30:31
$d = date_create('Monday +1 hour +20 minutes +10 seconds');
echo $d->format('Y-m-d : H:i:s') ;
2025-10-13 : 01:20:10
echo date('m-d-Y',strtotime('24-06-2018 next Monday ')); 06-25-2018

06-25-2018 Here we are getting output as date object and then converting to string by using format. We can directly get date as string by using strtotime.

Date as string by using strtotime()
By using this date object we can add, subtract or modify dates
PHP Date Functions Timestamp in PHP Displaying calendar for selection of date by user
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer