How to show the current date and time in PHP?

Php has a pre-defined function for date and time that is “date”,

<?php
    $currentDateTime = date('Y-m-d H:i:s');
    echo "Your current Date and time is:" . $currentDateTime;
?>

the output is: Your current Date and time is:2020-01-26 12:11:05

0 0 votes
Article Rating

Do you want to hire us for your Project Work? Then Contact US.
Spread the love
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x