开发者

mysql date and time auto stamp?

开发者 https://www.devze.com 2023-01-24 06:24 出处:网络
I need to separately insert a Date into one field m_DATE (11-10-2010) and then a time into m_TIME (01:15:03) either 24hr or 12hr with an am/pm. How would I go about doin开发者_C百科g this.

I need to separately insert a Date into one field m_DATE (11-10-2010) and then a time into m_TIME (01:15:03) either 24hr or 12hr with an am/pm. How would I go about doin开发者_C百科g this.

Sorry I don't have any example to work with I know there is Current_Timestamp but that does everything in one field.


Use

select DATE(CURRENT_TIMESTAMP)

for the date part and

select TIME(CURRENT_TIMESTAMP)

for the time part. If you want the date and the time of another timestamp than CURRENT_TIMESTAMP, you pass your own parameter to the above mentioned function.

0

精彩评论

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