ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


Action unknown: siteexport_addpage
v5:datetime:adodb_date

adodb_date

See Also

PHP Function date()

Syntax
string adodb_date(
    string $format,
    optional mixed $timestamp = false
)

Deprecated since ADOdb 5.22.6, and removed in 5.23.0. Use 64-bit native PHP functions instead.

Description

This function converts a timestamp to a formatted local date. If $timestamp is not defined, the current timestamp is used. Unlike the function date(), it supports dates outside the 1901 to 2038 range. To produce a date prior to the epoch date, a negative number of seconds prior to that number can be provided


Usage

print adodb_date('d/m/Y');
/*
* Prints 03/12/2015
*/
 
print adodb_date('d/m/Y',0);
/*
* Prints 12/31/1969
*/
 
print adodb_date('d/m/Y', -27454896000);
/*
* Prints 12/21/1099
*/

Available Formats

The format fields that adodb_date supports:

a - "am" or "pm"
A - "AM" or "PM"
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
D - day of the week, textual, 3 letters; e.g. "Fri"
F - month, textual, long; e.g. "January"
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
h - hour, 12-hour format; i.e. "01" to "12"
H - hour, 24-hour format; i.e. "00" to "23"
i - minutes; i.e. "00" to "59"
j - day of the month without leading zeros; i.e. "1" to "31"
l - (lowercase 'L') - day of the week, textual, long; e.g. "Friday"
L - boolean for whether it is a leap year; i.e. "0" or "1"
m - month; i.e. "01" to "12"
M - month, textual, 3 letters; e.g. "Jan"
n - month without leading zeros; i.e. "1" to "12"
O - Difference to Greenwich time in hours; e.g. "+0200"
Q - Quarter, as in 1, 2, 3, 4
r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200"
s - seconds; i.e. "00" to "59"
S - English ordinal suffix for the day of the month, 
    2 characters i.e. "st", "nd", "rd" or "th"
t - number of days in the given month; i.e. "28" to "31"
T - Timezone setting of this machine; e.g. "EST" or "MDT"
U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Y - year, 4 digits; e.g. "1999"
y - year, 2 digits; e.g. "99"
z - day of the year; i.e. "0" to "365"
Z - timezone offset in seconds (i.e. "-43200" to "43200").
    The offset for timezones west of UTC is always negative, 
    and for those east of UTC is always positive.

The following formats are unsupported:

B - Swatch Internet time
I - (capital i) - "1" if Daylight Savings Time, "0" otherwise.
W - ISO-8601 week number of year, weeks starting on Monday
v5/datetime/adodb_date.txt · Last modified: 2023/05/18 18:55 by dregad