libxml_set_external_entity_loader()
libxml_set_streams_context()
libxml_use_internal_errors()
PHP Mail
ezmlm_hash()
mail()
PHP Math
abs()
acos()
acosh()
asin()
asinh()
atan()
atan2()
atanh()
base_convert()
bindec()
ceil()
cos()
cosh()
decbin()
dechex()
decoct()
deg2rad()
exp()
expm1()
floor()
fmod()
getrandmax()
hexdec()
hypot()
intdiv()
is_finite()
is_infinite()
is_nan()
lcg_value()
log()
log10()
log1p()
max()
min()
mt_getrandmax()
mt_rand()
mt_srand()
octdec()
pow()
rad2deg()
rand()
round()
sin()
sinh()
sqrt()
srand()
tan()
tanh()
PHP Misc
connection_aborted()
connection_status()
connection_timeout()
constant()
define()
defined()
die()
eval()
exit()
get_browser()
__halt_compiler()
highlight_file()
highlight_string()
hrtime()
ignore_user_abort()
pack()
php_strip_whitespace()
show_source()
sleep()
sys_getloadavg()
time_nanosleep()
time_sleep_until()
uniqid()
unpack()
usleep()
PHP MySQLi
affected_rows
autocommit
change_user
character_set_name
close
commit
connect
connect_errno
connect_error
data_seek
debug
dump_debug_info
errno
error
error_list
fetch_all
fetch_array
fetch_assoc
fetch_field
fetch_field_direct
fetch_fields
fetch_lengths
fetch_object
fetch_row
field_count
field_seek
get_charset
get_client_info
get_client_stats
get_client_version
get_connection_stats
get_host_info
get_proto_info
get_server_info
get_server_version
insert_id
more_results
multi_query
next_result
options
prepare
query
real_connect
real_escape_string
real_query
reap_async_query
refresh
rollback
select_db
set_charset
set_local_infile_handler
sqlstate
ssl_set
stmt_init
thread_id
thread_safe
use_result
warning_count
PHP Network
checkdnsrr()
closelog()
dns_check_record()
dns_get_mx()
dns_get_record()
fsockopen()
gethostbyaddr()
gethostbyname()
gethostbynamel()
gethostname()
getmxrr()
getprotobyname()
getprotobynumber()
getservbyname()
getservbyport()
header_register_callback()
header_remove()
header()
headers_list()
headers_sent()
http_response_code()
inet_ntop()
inet_pton()
ip2long()
long2ip()
openlog()
pfsockopen()
setcookie()
setrawcookie()
socket_get_status()
socket_set_blocking()
socket_set_timeout()
syslog()
PHP Output Control
flush()
ob_clean()
ob_end_clean()
ob_end_flush()
ob_flush()
ob_get_clean()
ob_get_contents()
ob_get_flush()
ob_get_length()
ob_get_level()
ob_gzhandler()
ob_implicit_flush()
ob_list_handlers()
ob_start()
output_add_rewrite_var()
output_reset_rewrite_vars()
PHP RegEx
preg_filter()
preg_grep()
preg_last_error()
preg_match()
preg_match_all()
preg_replace
preg_replace_callback
preg_replace_callback_array
preg_split
preg_quote
PHP SimpleXML
__construct()
__tostring()
addAttribute()
addChild()
asXML()
attributes()
children()
count()
getDocNamespaces()
getName()
getNamespaces()
registerXPathNamespace()
saveXML()
simplexml_import_dom()
simplexml_load_file()
simplexml_load_string()
xpath()
current()
getchildren()
haschildren()
key()
next()
rewind()
valid()
PHP Stream
PHP String
addcslashes()
addslashes()
bin2hex()
chop()
chr()
chunk_split()
convert_cyr_string()
convert_uudecode()
convert_uuencode()
count_chars()
crc32()
crypt()
echo()
explode()
fprint()
get_html_translation_table()
hebrev()
hebrevc()
hex2bin()
html_entity_decode()
htmlentities()
htmlspecialchars_decode()
htmlspecialchars()
implode()
join()
lcfirst()
levenshtein()
localeconv()
ltrim()
md5()
md5_file()
metaphone()
money_format()
nl_langinfo()
nl2br()
number_format()
ord()
parse_str()
print()
printf()
quoted_printable_decode()
quoted_printable_encode()
quotemeta()
rtrim()
setlocale()
sha1()
sha1_file()
similar_text()
soundex()
sprintf()
sscanf()
str_getcsv()
str_ireplace()
str_pad()
str_repeat()
str_replace()
str_rot13()
str_shuffle()
str_split()
str_word_count()
strcasecmp()
strchr()
strcmp()
strcoll()
strcspn()
strip_tags()
stripcslashes()
stripslashes()
stripos()
stristr()
strlen()
strnatcasecmp()
strnatcmp()
strncasecmp()
strncmp()
strpbrk()
strpos()
strrchr()
strrev()
strripos()
strrpos()
strspn()
strstr()
strtok()
strtolower()
strtoupper()
strtr()
substr()
substr_compare()
substr_count()
substr_replace()
trim()
ucfirst()
ucwords()
vfprintf()
vprintf()
vsprintf()
wordwrap()
PHP Variable Handling
boolval()
debug_zval_dump()
doubleval()
is_countable()
empty()
floatval()
get_defined_vars()
get_resource_type()
gettype()
intval()
is_array()
is_bool()
is_callable()
is_double()
is_float()
is_int()
is_integer()
is_iterable()
is_long()
is_null()
is_numeric()
is_object()
is_real()
is_resource()
is_scalar()
is_string()
isset()
print_r()
serialize()
settype()
strval()
unserialize()
unset()
var_dump()
var_export()
PHP XML Parser
utf8_decode()
utf8_encode()
xml_error_string()
xml_get_current_byte_index()
xml_get_current_column_number()
xml_get_current_line_number()
xml_get_error_code()
xml_parse()
xml_parse_into_struct()
xml_parser_create_ns()
xml_parser_create()
xml_parser_free()
xml_parser_get_option()
xml_parser_set_option()
xml_set_character_data_handler()
xml_set_default_handler()
xml_set_element_handler()
xml_set_end_namespace_decl_handler()
xml_set_external_entity_ref_handler()
xml_set_notation_decl_handler()
xml_set_object()
xml_set_processing_instruction_handler()
xml_set_start_namespace_decl_handler()
xml_set_unparsed_entity_decl_handler()
PHP Zip
zip_close()
zip_entry_close()
zip_entry_compressedsize()
zip_entry_compressionmethod()
zip_entry_filesize()
zip_entry_name()
zip_entry_open()
zip_entry_read()
zip_open()
zip_read()
PHP Timezones
Definition and Usage
The date_format() function returns a date formatted according to the specified format.
Note:
This function does not use locales (all output is in
English).
Tip:
Also look at the
date()
function, which formats a local date/time.
Syntax
date_format(
object, format)
Parameter Values
Parameter
Description
object
Required. Specifies a DateTime object returned by
date_create()
format
Required. Specifies the format for the date. The following characters can be used:
d - The day of the month (from 01 to 31)
D - A textual representation of a day (three letters)
j - The day of the month without leading zeros (1 to 31)
l (lowercase 'L') - A full textual representation of a day
N - The ISO-8601 numeric representation of a day (1 for Monday, 7 for Sunday)
S - The English ordinal suffix for the day of the month (2 characters st, nd, rd or th. Works well with j)
w - A numeric representation of the day (0 for Sunday, 6 for Saturday)
z - The day of the year (from 0 through 365)
W - The ISO-8601 week number of year (weeks starting on Monday)
F - A full textual representation of a month (January through December)
m - A numeric representation of a month (from 01 to 12)
M - A short textual representation of a month (three letters)
n - A numeric representation of a month, without leading zeros (1 to 12)
t - The number of days in the given month
L - Whether it's a leap year (1 if it is a leap year, 0 otherwise)
o - The ISO-8601 year number
Y - A four digit representation of a year
y - A two digit representation of a year
a - Lowercase am or pm
A - Uppercase AM or PM
B - Swatch Internet time (000 to 999)
g - 12-hour format of an hour (1 to 12)
G - 24-hour format of an hour (0 to 23)
h - 12-hour format of an hour (01 to 12)
H - 24-hour format of an hour (00 to 23)
i - Minutes with leading zeros (00 to 59)
s - Seconds, with leading zeros (00 to 59)
u - Microseconds (added in PHP 5.2.2)
e - The timezone identifier (Examples: UTC, GMT, Atlantic/Azores)
I (capital i) - Whether the date is in daylights savings time (1 if Daylight Savings Time, 0 otherwise)
O - Difference to Greenwich time (GMT) in hours (Example: +0100)
P - Difference to Greenwich time (GMT) in hours:minutes (added in PHP 5.1.3)
T - Timezone abbreviations (Examples: EST, MDT)
Z - Timezone offset in seconds. The offset for timezones west of UTC is negative (-43200 to 50400)
c - The ISO-8601 date (e.g. 2013-05-05T16:34:42+00:00)
r - The RFC 2822 formatted date (e.g. Fri, 12 Apr 2013 12:01:05 +0200)
U - The seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
and the following predefined constants can also be used (available since PHP 5.1.0):
DATE_ATOM - Atom (example: 2013-04-12T15:52:01+00:00)
DATE_COOKIE - HTTP Cookies (example: Friday, 12-Apr-13 15:52:01 UTC)
DATE_ISO8601 - ISO-8601 (example: 2013-04-12T15:52:01+0000)
DATE_RFC822 - RFC 822 (example: Fri, 12 Apr 13 15:52:01 +0000)
DATE_RFC850 - RFC 850 (example: Friday, 12-Apr-13 15:52:01 UTC)
DATE_RFC1036 - RFC 1036 (example: Fri, 12 Apr 13 15:52:01 +0000)
DATE_RFC1123 - RFC 1123 (example: Fri, 12 Apr 2013 15:52:01 +0000)
DATE_RFC2822 - RFC 2822 (Fri, 12 Apr 2013 15:52:01 +0000)
DATE_RFC3339 - Same as DATE_ATOM (since PHP 5.1.3)
DATE_RSS - RSS (Fri, 12 Aug 2013 15:52:01 +0000)
DATE_W3C - World Wide Web Consortium (example: 2013-04-12T15:52:01+00:00)
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
[email protected]
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our
terms of use
,
cookie and privacy policy
.
W3Schools is Powered by W3.CSS
.