Tutorial: set your preferred date and time format

Getting the most out of Eileen's Lounge!
User avatar
HansV
Administrator
Posts: 69428
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Tutorial: set your preferred date and time format

Post by HansV »

Our forum software allows you to set your own preferred date and time format:
  • Click 'User Control Panel'.
  • Click 'Board Preferences'.
  • Select either a predefined format or Custom... from the 'My date format' dropdown.
  • If you selected Custom..., edit the custom format in the text box below the dropdown.
    See below for a list of codes that you can use.
  • Click Submit.
x1.png
Here are some of the codes you can use in a custom date/time format:

Day

j = day of the month without leading zeros: 1 to 31
d = day of the month with leading zeros: 01 to 31
D = day of the week, abbreviated: Mon through Sun
l (lowercase 'L') = day of the week, full: Sunday through Saturday
S = ordinal suffix for the day of the month, 2 characters: st, nd, rd or th. Works well with j.

Month

n = month number without leading zeros: 1 through 12
m = month number with leading zeros: 01 through 12
M = name of the month, abbreviated: Jan through Dec
F = name of the month, full: January through December

Year

y = year, 2 digits: 99, 00, ...
Y = year, 4 digits: 1999, 2000, ...

Time

a = am or pm
A = AM or PM
g = 12-hour format hour without leading zeros: 1 through 12
h = 12-hour format hour with leading zeros: 01 through 12
G = 24-hour format hour without leading zeros 0 through 23
H = 24-hour format hour with leading zeros: 00 through 23
i = minutes with leading zeros: 00 to 59

Complete formats

c = ISO 8601 formatted date and time, e.g. 2010-02-08T13:25:21+01:00
r = RFC 2822 formatted date and time, e.g. Fri, 08 Jan 2010 13:25:21 +0100

For an overview of all available codes, see PHP: date - Manual.

Examples:

d-M-Y H:i results in 08-Jan-2010 13:25
l, F jS Y, g:i A results in Friday, January 8th 2010, 1:25 PM
You do not have the required permissions to view the files attached to this post.
Regards,
Hans