acctman
acctman

Reputation: 4349

mysql date and time auto stamp?

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 doing this.

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

Upvotes: 2

Views: 499

Answers (1)

Lajos Arpad
Lajos Arpad

Reputation: 76717

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.

Upvotes: 1

Related Questions