myBlog

Membuat MySQL timestamp

on October 19, 2011

Statement : UNIX_TIMESTAMP(date)

Fungsi ini menghasilkan nilai unix_timestamp dengan tipe data integer

Contoh :

mysql> SELECT UNIX_TIMESTAMP(‘2009-01-01 18:20:19’);

-> 1230808819

Kebalikan dari fungsi diatas adalah

Statement : FROM_UNIXTIME(unix_timestamp)

Fungsi ini menghasilkan tanggal dari nilai unix_timestamp

Contoh :

mysql> SELECT FROM_UNIXTIME(1230808819);

-> 2009-01-01 18:20:19

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: