Skip to content

Instantly share code, notes, and snippets.

Last active February 8, 2019 15:20
What would you like to do?
Favorite PHP Date Formats

U.S. clients with mostly U.S. users


Used whenever there is room to display a long form date. These are the prefered format whenever possible.

Sunday, January 10, 2010 - 9:30pm
l, F j, Y - g:ia

Sunday, January 10 - 9:30pm
l, F j - g:ia

Sunday, January 10, 2010
l, F j, Y

Sunday, January 10
l, F j


Used when you want an understandable display but need compactness. Generally you want to keep the format consistent in each location. One exception might be to use medium format when there is a range of dates and long format when there is a single date. This would give them approximately the same horizontal width.

Jan 10, 2010 9:30pm
M j, Y g:ia

Sun, Jan 10
D, M j


Shortest version for front end display. Avoid when possible as it can cause international confusion.


01/10/2010 9:30pm
m/d/Y g:ia


Use in all filename or backend systems. Perfect for sorting by date and avoiding international confusion. Avoid for front end and when you need a “pretty” display.

2004-01-28 13:14:15
Y-m-d H:i:s

Clients with majority non-US user base

Consult with the client and consider using Euro date formatting if appropriate:

10 Jan, 2010 13:14
j M, Y H:i


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment