How do I format the date and time That is received from database
Iam getting the date and time from Database as follows
Date : 20100101(YYYY/MM/DD) Time : 120912 (HH:MM:SS)
I have to form开发者_Go百科at the Date as follows 20100101 --> (2010-10-11) (look to have ) "-" in between year and month and Day
I have to format the time as follows 120912 --> 12:02:12 suppose I may have the time as 62367 from the database
06:23:67
I recommend you convert the data using: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
we can use DATE_FORMAT(fieldname,format )
function in mysql
For Example we can use DATE_FORMAT( a.date, '%d-%m-%Y' )
精彩评论