gmstrftime

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;

?>
2023-02-01 09:15:40

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

checkdate

date

date_add

date_create

date_create_from_format

date_create_immutable

date_create_immutable_from_format

date_date_set

date_default_timezone_get

date_default_timezone_set

date_diff

date_format

date_get_last_errors

date_interval_create_from_date_string

date_interval_format

date_isodate_set

date_modify

date_offset_get

date_parse

date_parse_from_format

date_sub

date_sun_info

date_sunrise

date_sunset

date_time_set

date_timestamp_get

date_timestamp_set

date_timezone_get

date_timezone_set

getdate

gettimeofday

gmdate

gmmktime

idate

localtime

microtime

mktime

strftime

strptime

strtotime

time

timezone_abbreviations_list

timezone_identifiers_list

timezone_location_get

timezone_name_from_abbr

timezone_name_get

timezone_offset_get

timezone_open

timezone_transitions_get

timezone_version_get

PHP

Home Menu