date

PHP Date and Time Functions

PHP Date and Time Functions

PHP provides a range of functions to work with date and time. Some useful functions are date(), time(), and strtotime().

Getting Current Date and Time

To get the current date and time, use date():

      
        <?php
          echo date("Y-m-d H:i:s"); // Outputs current date and time
        ?>
      
    

Getting Unix Timestamp

To get the current Unix timestamp, use time():