Re: [PHP-DB] Date calculation from MySql table

2008-04-12 Thread Evert Lammerts
Something like this should work. $today = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $tomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")); $sql = "SELECT COUNT(*) FROM table WHERE regdate BETWEEN {$today} AND {$tomorrow}"; $thismonth = mktime(0, 0, 0, date("m"), 1, date("Y")

RE: [PHP-DB] Date Calculation

2001-11-13 Thread Rick Emery
Since you mentioned MYSQL, I'm assuming you have some sort of database query in mind. For instance, finding dates in a date field in a table in which 14 days from that field date is significant. For instance, the following locates records whose records contain date fields less than 14 days from t

RE: [PHP-DB] Date Calculation

2001-11-12 Thread Beau Lebens
in PHP, coming out in yyy-mm-dd date("Y-m-d", mktime(0,0,0, date("m"), date("d")+14, date("Y")); untested, so please test it - this will ignore hours, minutes, seconds (the leading 3 0's) and make a timestamp using mktime for this month, this day + 14, this year, then return it formatted as yyy-m