beginning of day timestamps
01 August 2006
mark got me thinking about this, and then i was messing around with one of my own projects that needed the same feature, and i realized the easy way to do it.
i would always get the year/month/day out of a timestamp using the date() function, and then create a new timestamp with mktime().
i just realized the best way is:
$now = time();
$beginningofday = $now - ($now % 86400);
this works for me because i definitely remember that number for seconds in a day, and avoids any locale-dependent variations. plus, end of day becomes just as easy.