How to use getdate in PHP
This article describe about getdate() function in PHP.
getdate() function
This function returns an array which contain date and time information for Unix timestamp.
When it return array contain ten information needed at the time format of date string.
- [hours] - hours
- [yday] - day of the year
- [weekday] - name of the weekday
- [month] - name of the month
- [mday] - day of the month
- [wday] - day of the week
- [year] - year
- [seconds] - seconds
- [minutes] - minutes
Syntax
Parameter |
Description |
timestamp |
Optional. Define the time in Unix format. |
Example 1
<html>
<body>
<?php
print_r(getdate());
?>
</body>
</html> |
Output
Example 2
<html>
<body>
<?php
$my_f=getdate(date("U"));
print("$my_f[weekday], $my_f[month] $my_f[mday], $my_f[year]");
?>
</body>
</html> |
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here