Tag Archives: Functions

date_parse

It returns associative array with detailed info about given date

Example

<?php
echo “<pre>”;
print_r(date_parse(“2006-12-12 10:00:00.5”));
?>

Output

Array
(
[year] => 2006
[month] => 12
[day] => 12
[hour] => 10
[minute] => 0
[second] => 0
[fraction] => 0.5
[warning_count] => 0
[warnings] => Array
(
)

[error_count] => 0
[errors] => Array
(
)

[is_localtime] =>
)

date_parse_from_format

It returns details  about given date formatted according to the specified format.

Example

<?php
echo “<pre>”;
$date = “20.4.2008”;
print_r(date_parse_from_format(“j.n.Y H:iP”, $date));
?>

Output

Array
(
[year] => 2008
[month] => 4
[day] => 20
[hour] =>
[minute] =>
[second] =>
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)

[error_count] => 1
[errors] => Array
(
[9] => Data missing
)

[is_localtime] =>
)


php_uname

It returns information about the operating system PHP is running on

Example

<?php
echo php_uname();
?>

Ouput

Linux phpcodez-System-Product-Name 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:36:48 UTC 2010 i686