PHP getdate function

The getdate function returns an array that contains several key/ value pairs, representing the current date/time at the server:

mday From 1 to 31 (day of the month)
wday From 0 to 6 (Sunday to Saturday)
mon Numeric month of year, 1 to 12
month Textual equivalent of mon, January to December
year The year, in four-digit format; that is, 2008
yday The day of the year, zero-based
hours The hour component of the current time, 0 to 23
minutes The minute component of the current time, 0 to 59
seconds The second component of the current time, 0 to 59

Each of these key/value pairs can be accessed through its key:

$today_date = getdate();
echo "The month is $today_date['month'].";

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.