Catatan Web Developing, Kumpulan jalan keluar dari perpusing-pusing ria ketika web-dev, Insya Allah akan selalu saya update.
Wrong time?
date_default_timezone_set('Asia/Jakarta');
Zero digit before number?
sprintf("%06s", $number);
Garis panjang
—
Tanggal terahir bulan ini
date("Y-m-t", strtotime("today") );
Tanggal terahir dalam suatu bulan
date('Y-m-t', strtotime("2009-12"));
Menambah hari/minggu/bulan/tahun
$date = date("Y-m-d");// current date
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");
Mengatasi reload jquery / jquery-ui tabs
self.location = document.base_url + 'jadwal_umum#ui-tabs-3';
window.location.reload(false);
MySQL IF
IF(foo = 'bar',true,false) as variable
MySQL menggabungkan string
CONCAT(string1,string2,string3,...) as variable
MySQL group by 05:00 - 04:59 (beda hari)
SELECT TIMESTAMPADD(HOUR, 5, DATE(TIMESTAMPADD(HOUR, -5, laporan_datetime))) AS custom24hours
FROM laporan
GROUP BY custom24hour
Written by harisrozak
