$ T = time ();
$ T1 = mktime (0, 0, 0, date ("m", $ t), date ("d", $ t), date ("Y", $ t ));
$ T2 = mktime (0, 0, 0, date ("m", $ t), 1, date ("Y", $ t ));
$ T3 = mktime (, 0, date ("m", $ t)-, date ("Y", $ t ));
$ T4 = mktime (, 1, date ("Y", $ t ));
$ E1 = mktime (, 59, date ("m", $ t), date ("d", $ t), date ("Y", $ t ));
$ E2 = mktime (, 59, date ("m", $ t), date ("t"), date ("Y", $ t ));
$ E3 = mktime (, 59, date ("m", $ t)-1, date ("t", $ t3), date ("Y ", $ t ));
$ E4 = mktime (, 31, date ("Y", $ t ));
// Test
Echo date ("Current Y-m-d H: I: s", $ t). "$ t <br> ";
Echo date ("today's start point Y-m-d H: I: s", $ t1). "$ t1 <br> ";
Echo date ("starting point of this month Y-m-d H: I: s", $ t2). "$ t2 <br> ";
Echo date ("starting from last month Y-m-d H: I: s", $ t3). "$ t3 <br> ";
Echo date ("This year's start point Y-m-d H: I: s", $ t4). "$ t4 <br> ";
// Test
Echo date ("end today Y-m-d H: I: s", $ e1). "$ e1 <br> ";
Echo date ("end of this month Y-m-d H: I: s", $ e2). "$ e2 <br> ";
Echo date ("end of last month Y-m-d H: I: s", $ e3). "$ e3 <br> ";
Echo date ("End of this year Y-m-d H: I: s", $ e4). "$ e4 <br> ";
Result:
Currently 15:42:55 1306222975
Starting from 00:00:00 1306166400
Starting from 00:00:00 1304179200
Starting from last month 00:00:00 1301587200
Starting from 00:00:00 this year, 1293811200
End of today: 23:59:59 1306252799
End of this month: 23:59:59 1306857599
Last month's endpoint 23:59:59 1304179199
End of this year 23:59:59 1325347199