Php get the current year month and day the number of days in this month

<?php
$y=date("Y",time());//Get the current year
$m=date("m",time());//Get the current month
$d=date("d",time());//Get the current date
$t0=date('t'); //How many days in this month
echo $d;
////////////////////////////////////////////////
echo strtotime(date('Y-m-d'));
   
Get the timestamp of tomorrow morning
Code: echo strtotime(date('Y-m-d',strtotime('+1 day')));
   
Attach the test code:
echo strtotime('2012-11-2');
echo strtotime('2012-11-2 00:00:00');
echo strtotime(date('Y-m-d')),'
';
echo date('Y-m-d H:i:s',strtotime(date('Y-m-d')));
echo strtotime(date('Y-m-d',strtotime('+1 day')));
echo ( strtotime(date('Y-m-d',strtotime('+1 day'))) - strtotime(date('Y-m-d')) )/3600;
   
Other reference codes:
   
echo "One week later:".date("Y-m-d",strtotime("+1 week"));
echo "After one week, two days, four hours and two seconds:".date("Y-m-d G:H:s",strtotime("+1 week 2 days 4 hours 2 seconds"));
echo "Next Thursday:".date("Y-m-d",strtotime("next Thursday"));
echo "Last Monday:".date("Y-m-d",strtotime("last Monday"));
echo "One month ago:".date("Y-m-d",strtotime("last month"));
echo "One month later:".date("Y-m-d",strtotime("+1 month"));
echo "Ten years later:".date("Y-m-d",strtotime("+10 year"));
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish