Wednesday, February 8, 2012

Compare date with PHP

Selalu nye kan... kalau nak wat coding PHP untuk compare tarikh mesti pening... kena wat if else utk day, month, year.... Sampai pening2... bile search on pakcik google... at last i found this simple of code yg wat my life happy sgt2... ;D

// your first date coming from a mysql database (date fields)
$dateA = '2008-03-01 13:34';

// your second date coming from a mysql database (date fields)
= '2007-04-14 15:23';

(strtotime($dateA) > strtotime($dateB)){
// bla bla


nak tau lebih details tentang comparison tarikh ni... try browse from this source

Wish you enjoy it... ;D


  1. Cik Erni.. bole ajar photoshop kt sni tak. :)

  2. photoshop? good idea gak tu.. boleh2.. nanti ade tutorial best eni share kan eyy.. ;D