Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

time()

Example

Retrieve the current time as a Unix timestamp and format it as a date.

<?php
$t=time();
echo($t . “<br>”);
echo(date(“Y-m-d”,$t));
?>

Definition and Usage

The time() function returns the current time as the number of seconds since the Unix Epoch (January 1, 1970, 00:00:00 GMT).

Syntax

time()

Technical Details

 

Return Value:

Returns an integer representing the current time as a Unix timestamp.

PHP Version:

4+