PHP getdate() function

P
PHP date() function
PHP gettimeofday() function

In this article, you will learn how to get information about a timestamp. The getdate() function returns the date/time information of a timestamp. The timestamp can be replaced with current local date/time to get its information.

What is the syntax of the function in PHP?

getdate(timestamp)
ParameterDescription
timestampOptional. Specifies an integer Unix timestamp. Default is the current local time (time())
PHP getdate() function

Example of the function

Example 1. In this example, we simply get the date/time information of the current local time.

<?php
print_r(getdate());
?>

PHP date() function
PHP gettimeofday() function

Add comment

Tutor Network

Share this

Learn PHP from A to Z