How to Get current time in PHP

Get current time in php- To get the current time, simply use the date function with the appropriate format string. To get only hours and minutes use H:i and if you also need the seconds, then use the H:i:s format string.

Code to Get current time in PHP-

// Current time in server timezone
$currentTime = date('H:i:s');
// Current time in selected timezone
date_default_timezone_set('America/New_York');
$currentTimeNY = date('H:i:s');