How to format the date and time that is obtained from the database

I get the date and time from the database as follows

Date: 20100101 (YYYY / MM / DD) Time: 120912 (HH: MM: SS)

I need to format the date as follows: 20100101 → (2010-10-11) (see to have) "-" between year and month and day

I need to format the time as follows: 120912 → 12:02:12 Suppose I can have time as 62367 from the database

06:23:67

+3
source share
2 answers

DATE_FORMAT(fieldname,format ) mysql DATE_FORMAT( a.date, '%d-%m-%Y' )

0

Source: https://habr.com/ru/post/1762998/


All Articles