Extract the Day / Month / Year from a Timestamp in PHP MySQL?

MySQLMySQLi DatabasePHP

To extract the Day/Month/Year from a timestamp, you need to use the date_parse() function. The syntax as follows −

print_r(date_parse(“anyTimeStampValue”));

The PHP code is as follows −

$yourTimeStampValue="2019-02-04 12:56:50";
print_r(date_parse($yourTimeStampValue));

The snapshot of PHP code is as follows −

The following is the output −

Array ( [year] => 2019 [month] => 2 [day] => 4 [hour] => 12 [minute] => 56 [second] => 50 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => )

The snapshot of the sample output −

raja
Published on 26-Feb-2019 16:36:15
Advertisements