开发者

How do I format the date and time That is received from database

开发者 https://www.devze.com 2023-01-14 01:39 出处:网络
Iam getting the date and time from Database as follows Date : 20100101(YYYY/MM/DD) Time : 120912 (HH:MM:SS)

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' )

0

精彩评论

暂无评论...
验证码 换一张
取 消