Get current timestamp with mckoi

Today I have been playing around with mckoi database. In MySQL, there’s a NOW() function. This function simply returns the current timestamp. However, mckoi doesn’t have this function but I need it! This is what I did to get the current timestamp:

SELECT DATEFORMAT(DATEOB(), ‘yyyy-mm-dd HH:mm:ss’)

Just to be a little bit more paranoid, I set this function as a default value for my timestamp column, when I created a database. This is the syntax that I’m using:


myTimestampColumn timestamp DEFAULT DATEFORMAT(DATEOB(), ‘yyyy-mm-dd HH:mm:ss’) not null

This is very helpful because during insertion, there’s no need to put an extra effort to manage myTimestampColumn. Everything is done automatically.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: