PHP localtime() Function
Complete PHP Date Reference
Definition and Usage
The localtime() function returns an array that contains the time components
of a Unix timestamp.
Syntax
|
localtime(timestamp,is_associative)
|
| Parameter |
Description |
| timestamp |
Optional. Specifies the date or time to be formatted. If no
timestamp is specified, it uses the current local time. |
| is_associative |
Optional. Specifies whether to return an associative or indexed array. If
set to false the array returned is an indexed array. If set to true then the
array returned is an associative array.
The keys of the associative array are:
- [tm_sec] - seconds
- [tm_min] - minutes
- [tm_hour] - hour
- [tm_mday] - day of the month
- [tm_mon] - month of the year (January=0)
- [tm_year] - Years since 1900
- [tm_wday] - Day of the week (Sunday=0)
- [tm_yday] - Day of the year
- [tm_isdst] - Is daylight savings time in effect
|
Example
Example without and with associative arrays:
<?php
print_r(localtime());
echo("<br /><br />");
print_r(localtime(time(),true));
?>
|
The output of the code above could be:
Array
(
[0] => 28
[1] => 35
[2] => 13
[3] => 25
[4] => 0
[5] => 106
[6] => 3
[7] => 24
[8] => 0
)
Array
(
[tm_sec] => 28
[tm_min] => 35
[tm_hour] => 13
[tm_mday] => 25
[tm_mon] => 0
[tm_year] => 106
[tm_wday] => 3
[tm_yday] => 24
[tm_isdst] => 0
)
|
Complete PHP Date Reference
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|