How to use getdate in PHP

This article describe about getdate() function in PHP.
  • 2423

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

getdate(timestamp)

 

Parameter Description
timestamp Optional. Define the time in Unix format.

Example 1

<html>
<body>
<?php
print_r(getdate());
?>
</body>
</html>

 

Output


pic7.jpg

 

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


pic8.jpg

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

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.