Tags
Asked 2 years ago
13 Jul 2021
Views 157
Patricia

Patricia posted

How can I get current date and time in PHP ?

How can I get current date and time in PHP ?
kiran

kiran
answered Aug 19 '21 00:00

to get current date and time can be got by date() function in php

date() function need format to display date and time
date() function return server date and time.

<?php
echo date('d-m-Y H:i:s'); // 19-08-2021 16:23:58
?>


above code will print date in day-month-Year Hour:Minute:Second format
Post Answer