gmdate
Name
gmdate — Prints a formatted GMT date.
Synopsis
string gmdate
(format[, time]);
string format: Format in
which to display the calculated date
int time (optional): Time in
UNIX time format
Returns
Formatted date output in GMT
Description
This function is similar in nearly all respects to date() . It displays a
date in a format specified in the first argument, except
that the date string is calculated to be displayed in
GMT. This is of more use when combined with mktime() or gmmktime() than when using a
static date string. Dates and times can be displayed in
any order and combination, with any delimiters. An
optional second argument can be used to format the date
from a specific time. If the second argument is omitted,
the current time is used. The following list describes
the format arguments:
-
a: am or pm
-
A: AM or PM
-
B: Swatch[tm] beat (also known as
"Internet time"; this is a new time standard
introduced by Swiss watchmaker Swatch)
-
d: Numeric day of the month
-
D: Short day abbreviation
-
F: Full month name
-
g: 12-hour time without leading zero
-
G: 24-hour time without leading zero
-
h: 12-hour time with leading zero
-
H: 24-hour time with leading zero
-
i: minutes with leading zero
-
I: (capital i) 1 if
Daylight Saving Time, 0 otherwise
-
j: day of month without leading zero
-
l: (lowercase L) Full day name
-
L: Boolean indicating a leap year (set to
1 if leap year)
-
m: Numeric month with leading zero
-
M: Short month abbreviation
-
n: Numeric month without leading zero
-
O: GMT offset in [+-]HHMM format
-
r: RFC 822 format
-
s: seconds
-
S: suffix to numerical date (for example,
st, nd, th as in '1st',
'2nd', and so on)
-
t: Numbers of days in this month (28 - 31)
-
T: Time zone name
-
U: UNIX seconds
-
w: Numeric day of the week
-
y: Two-digit year
-
Y: Four-digit year
-
z: Day number in the year
-
Z: Offset of current time zone to GMT in
minutes (-43200 to 43200)
Example
Example 201. Print the
current date and time in GMT
print("At the tone, the GMT time will be: " . gmdate("l F dS Y, H:i"));
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from
http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.