Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Waktu sekarang
- $now = date('Y-m-d H:i:s');
- // Waktu (1000 jam ke belakang)
- $min1000 = date('Y-m-d H:i:s', strtotime('-1000 hour'));
- // Waktu (1000 jam ke depan)
- $plus1000 = date('Y-m-d H:i:s', strtotime('+1000 hour'));
- // contoh 1: query (1000 jam sebelum sekarang sampai sekarang)
- $db->query("SELECT * from tabel_data where tanggal between '$min1000' AND '$now'");
- // contoh 2: query (sekarang sampai 1000 jam kedepan)
- $db->query("SELECT * from tabel_data where tanggal between '$now' AND '$plus1000'");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement