HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmstrftime

Description

The gmstrftime of Date / Time for PHP format a GMT/UTC time/date according to locale settings.

Syntax

gmstrftime ( string $format [, int $timestamp = time() ] ) : string

Parameters

format

See description in strftime().

timestamp

The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().

Return

Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given. Month and weekday names and other language dependent strings respect the current locale set with setlocale().

Examples

1 · format

<?

date_default_timezone_set("America/Los_Angeles");

$format = "%Y-%m-%d %H:%M:%S";

$return = gmstrftime($format);

echo $return;
2024-12-09 10:14:11

2 · timestamp

<?

date_default_timezone_set("America/Los_Angeles");

$format = "%Y-%m-%d %H:%M:%S";
$timestamp = mktime(4, 5, 6, 2, 3, 2001);

$return = gmstrftime($format, $timestamp);

echo $return;
2001-02-03 12:05:06