Web Analytics

PHP localtime() Function

Date/Time FunctionPHP 4+

The localtime() function returns the local time. It returns an array identical to the struct tm returned by the C function localtime. It's different from getdate() in terms of the keys returned.

Syntax

localtime(?int $timestamp = null, bool $associative = false): array

Parameters

  • associative: If set to false (default), it returns a regular, numerically indexed array. If set to true, it returns an associative array.

Try It Online

Output
Click Run to execute your code

Related Functions

  • getdate() - Get date/time information
  • time() - Return current Unix timestamp