Languages
[Edit]
EN

PHP - datetime format with PDO and MySQL

6 points
Created by:
DrJoystick
615

In this article date-time formatting with PDO and MySQL is presented.

1. Accepted formats

There are several accepted formats for date and time.

MySQL Type      PHP date() Format       Example

DATE            YYYY-MM-DD              2005-12-26
DATETIME        YYYY-MM-DD HH:MI:SS     2005-12-26 23:50:30
TIMESTAMP       YYYY-MM-DD HH:MI:SS     2005-12-26 23:50:30
YEAR            YYYY or YY              2019 or 19

MySQL with PDO example:

 

2. Database preparation

//TODO

Alternative titles

  1. PHP - date-time format with PDO and MySQL
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join