How do I get the current date and time in PHP

104

//Your Country Time Zone: https://www.php.net/manual/en/timezones.php

date_default_timezone_get(Asia/Dhaka);

$dateYmd = date('Y-m-d');
echo "Current Year Month Day: $dateYmd";
//Current Year Month Day: 2022-01-14

$datehms = date('h:i:s');
echo "Current Hour Minute Second: $datehms";
//Current Hour Minute Second: 10:33:58

Comments

Submit
0 Comments