Extract the Day / Month / Year from a Timestamp in PHP MySQL?
To extract the Day/Month/Year from a timestamp, you need to use the date_parse() function. The syntax as follows −
The PHP code is as follows −
The snapshot of PHP code is as follows −
The following is the output −
Array ( [year] => 2019 [month] => 2 [day] => 4 [hour] => 12 [minute] => 56 [second] => 50 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => )
The snapshot of the sample output −
Published on 26-Feb-2019 12:06:15
- Related Questions & Answers
- Create date from day, month, year fields in MySQL?
- How can we extract the Year and Month from a date in MySQL?
- Fetch month, day, year, etc. from ISODate in MongoDB?
- Filter the records of current day, month and year in MySQL?
- Format MySQL date and convert to year-month-day
- How to get a Date from year, month and day in Java?
- Combine three strings (day, month, year) and calculate next date PHP?
- MySQL extract year from date format?
- Convert day of year to day of month in Java
- Extract the month and year in the following format: “mm-yyyy” (month year) along with all columns in MySQL?
- How to extract only the month and day from a datetime object in Python?
- How to convert year, month, and day of the month into a complete date in R?
- How to get day name from timestamp in MySQL?
- How to compare Year, Month and Day in a MySQL query and display matching records