- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Extracting only date from datetime field in MySQL and assigning it to PHP variable?
You need to use DateTime class if you want to extract the only date from datetime field. The syntax is as follows −
Now you can implement the above syntax in your PHP code to extract the only date from datetime field. The PHP code is as follows −
$MySQLDataBaseDateTime = "2018-02-13 13:10:15"; echo DateTime::createFromFormat("Y-m-d H:i:s",$MySQLDataBaseDateTime)->format("d/m/Y");
Here is the screenshot of the PHP code −
- Get only the date from datetime in MySQL?
- How to select only MySQL date from datetime column?
- Compare DATE string with string from MySQL DATETIME field?
- MySQL query to get current datetime and only current date
- Add DATE and TIME fields to get DATETIME field in MySQL?
- Create DATETIME from DATE and TIME in MySQL?
- How to extract from datetime column in MySQL by comparing only date and ignoring whitespace?
- How to update date of datetime field with MySQL?
- How to part DATE and TIME from DATETIME in MySQL?
- Compare only day and month with date field in MySQL?
- MySQL Query to convert from datetime to date?
- How to get only Date portion from DateTime object in C#?
- MySQL query to get only the minutes from datetime?
- How to compare DateTime Column with only Date not time in MySQL?
- Insert datetime into another datetime field in MySQL?