Skip to content

date ​

php
string date(string $format, [number $znacznik_czasu])

The date() function returns a time formatted according to $format. It behaves like PHP's date() function. If the optional $znacznik_czasu argument is omitted, it uses the current Unix timestamp (as returned by time()). If $znacznik_czasu is not a number, the function returns false.

To format a date, use one or more of the characters in the following table as the $format argument.

The original table comes from http://www.php.net/manual/pl/function.date.php.

Use the following characters as text in the argument.

Contents ofDescriptionExample return value
Day
dDay of the month, two digits with leading zeros01 through 31
DAbbreviated English weekday name, three lettersMon through Sun
jDay of the month without leading zeros1 through 31
l (lowercase 'L')Full English name of the day of the weekSunday through Saturday
NISO-8601 numeric representation of the day of the week1 (Monday) through 7 (Sunday)
SEnglish ordinal suffix for the day of the month, two charactersst, nd, rd or th. Works well with j
wNumeric representation of the day of the week0 (Sunday) through 6 (Saturday)
zDay of the year, starting at 00 through 365
Week
WISO-8601 week number of the year; weeks start on Monday **Example:** 42 (the 42nd week of the year)
Month
FFull English month name, such as January or MarchJanuary through December
mNumeric representation of the month with leading zeros01 through 12
MAbbreviated English month name, three charactersJan through Dec
nNumeric representation of the month without leading zeros1 through 12
tNumber of days in the month28 through 31
Year
LWhether the year is a leap year1 for a leap year, otherwise 0.
oISO-8601 week-numbering year. This is the same as Y, except when the ISO week number (W) belongs to the previous or following year.Examples: 1999 or 2003
YFull numeric representation of a year, four digitsExamples: 1999 or 2003
yTwo-digit representation of a yearExamples: 99 or 03
Time
aLowercase ante meridiem or post meridiemam or pm
AUppercase ante meridiem or post meridiemAM or PM
BSwatch Internet Time000 through 999
gHour in 12-hour format without leading zeros1 through 12
GHour in 24-hour format without leading zeros0 through 23
hHour in 12-hour format with leading zeros01 through 12
HHour in 24-hour format with leading zeros00 through 23
iMinutes with leading zeros00 through 59
sSeconds with leading zeros00 through 59
uMicrosecondsExample: 54321
Time zone
eTime zone identifierExamples: UTC, GMT, Europe/Zagreb
I (uppercase i)Whether daylight saving time is in effect1 during daylight saving time, otherwise 0.
ODifference from Greenwich Mean Time (GMT) in hoursExample: +0200
PDifference from GMT with a colon between hours and minutesExample: +02:00
TTime zone abbreviationExamples: EST, MDT ...
ZTime zone offset in seconds. Negative for time zones west of the prime meridian and positive for those east of it.-43200 through 50400
Full date/time
cISO 8601 date2004-02-12T15:19:21+00:00
rRFC 2822 formatted dateExample: Thu, 21 Dec 2000 16:01:07 +0200
USeconds since the Unix epoch (1 January 1970, 00:00:00 GMT)See also time()
Other characters in the format string are copied unchanged by the parser.

Examples:

Example

Result
date("Y-m-d H:i:s")2010-02-23 13:12:34
date("l d F Y")Tuesday 23 February 2010
date("g:i a")1:12 pm
date("Y-m-d H:i:s", time()+3600)2010-02-23 14:12:34