Get week From Datetime in Mysql

Misalnya ada tabel t_transaksi dengan field : amount (int), trans_type(int), created_by(varchar 50), created_on(timestamp), maka untuk mengambil week dari field created_on yaitu field created_on dijadikan DATE dulu, lalu dicari WEEK nya, command nya sbb:

SELECT WEEK (DATE(created_on)) FROM t_transaksi;

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