PHP getdate() Function
Complete PHP Date Reference
Definition and Usage
The getdate() function returns an array that contains date and time
information for a Unix timestamp.
The returning array contains ten elements with relevant information needed
when formatting a date string:
- [seconds] - seconds
- [minutes] - minutes
- [hours] - hours
- [mday] - day of the month
- [wday] - day of the week
- [year] - year
- [yday] - day of the year
- [weekday] - name of the weekday
- [month] - name of the month
Syntax
| Parameter |
Description |
| timestamp |
Optional. Specifies the time in Unix time format |
Example 1
<?php
print_r(getdate());
?>
|
The output of the code above could be:
Array
(
[seconds] => 45
[minutes] => 52
[hours] => 14
[mday] => 24
[wday] => 2
[mon] => 1
[year] => 2006
[yday] => 23
[weekday] => Tuesday
[month] => January
[0] => 1138110765
)
|
Example 2
<?php
$my_t=getdate(date("U"));
print("$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year]");
?>
|
The output of the code above could be:
|
Wednesday, January 25, 2006
|
Complete PHP Date Reference

Need an easy way to get data into XML, or transform XML to another format?
MapForce lets you map XML data to/from any combination of XML, database, flat file,
Excel 2007, XBRL, or Web services data. Then it transforms data instantly or
auto-generates royalty-free code for recurrent conversions.
New features in Version 2010!
- Easy-to-use, graphical data mapping interface
- Instant data transformation
- XSLT 1.0/2.0 and XQuery code generation
- Java, C#, and C++ code generation
- Advanced data processing functions
- Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
- Visual Studio & Eclipse integration
- Available in 32-bit and 64-bit versions
Download a fully-functional trial today!
|
|
|
|