/**
- Example of a php timestamp combination application
- Date: 2013/2/19
- Link: http://bbs.it-home.org
- */
- $ 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
";
- Echo date ("Today's start point Y-m-d H: I: s", $ t1). "$ t1
";
- Echo date ("starting point of this month Y-m-d H: I: s", $ t2). "$ t2
";
- Echo date ("starting from last month Y-m-d H: I: s", $ t3). "$ t3
";
- Echo date ("This year's start point Y-m-d H: I: s", $ t4). "$ t4
";
- // Test
- Echo date ("end today Y-m-d H: I: s", $ e1). "$ e1
";
- Echo date ("end of this month Y-m-d H: I: s", $ e2). "$ e2
";
- Echo date ("end of last month Y-m-d H: I: s", $ e3). "$ e3
";
- Echo date ("end of this year Y-m-d H: I: s", $ e4). "$ e4
";
- ?>
Output result: currently 15:42:55 1306222975 today's start point 00:00:00 1306166400 this month's start point 00:00:00 1304179200 last month's start point 00:00:00 1301587200 this year's start point 00:00:00 1293811200 today's end point 23:59:59 1306252799 last month's end point 23:59:59 1304179199 end of this year 23:59:59 1325347199 |