tags:

views:

31

answers:

3

I'm working on a calendar app and need to get the timestamps for the beginning of each day/month etc:

whats the best method?

//get timestamps for start of (day, month, year)
$ts_now         = time();
$ts_today      = 
$ts_this_month  =
$ts_this_year   =
+1  A: 
$ts_today       = mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) );
$ts_this_month  = mktime( 0, 0, 0, date( 'm' ), 0, date( 'Y' ) );
$ts_this_year   = mktime( 0, 0, 0, 0, 0, date( 'Y' ) );

I guess...

nunthrey
A: 

Manual: StrToTime

Adam Kiss
+1  A: 
$ts_today = strtotime('today');
$ts_this_month = strtotime("1st ".date('F')." ".idate('Y'));
$ts_this_year = strtotime( '1st january '.idate('Y') );
SpawnCxy