phpretard Posted June 4, 2009 Share Posted June 4, 2009 I would like to display the current month's 1st and last day. It has to be simple I just cant figure it out based on php.net's site $First=date('Y-m-d h:i:s'); $Last=date('Y-m-d h:i:s'); echo $First should be "2009-6-1 12:01" echo $Last should be "2009-6-30 11:59" Thank you for looking. Quote Link to comment Share on other sites More sharing options...
gevans Posted June 4, 2009 Share Posted June 4, 2009 something like this; echo $first_day = date("Y-m-d", strtotime("1 ". date("F Y"))); echo '<br />'; echo $last_day = date("Y-m-d", strtotime(date("t F Y"))); Quote Link to comment Share on other sites More sharing options...
phpretard Posted June 4, 2009 Author Share Posted June 4, 2009 Thank you very much. echo $first_day = date("Y-m-d h:i:s", strtotime("1 ". date("F Y"))); echo '<br />'; echo $last_day = date("Y-m-d h:i:s", strtotime(date("t F Y "))); above outputs: 2009-06-01 12:00:00 2009-06-30 12:00:00 I dont quite understand: "strtotime(date("t F Y ")));" Where can I adjust to output?: 2009-06-01 12:00:00 2009-06-30 11:59:59 Thanks again Quote Link to comment Share on other sites More sharing options...
gevans Posted June 4, 2009 Share Posted June 4, 2009 <?php echo date("Y-m-d 12:00:00", strtotime("1 ". date("F Y"))); echo '<br />'; echo date("Y-m-d 11:59:59", strtotime(date("t F Y"))); ?> I've just put it in manually, as the start and end time of a day aren't changing anytime soon Quote Link to comment Share on other sites More sharing options...
phpretard Posted June 4, 2009 Author Share Posted June 4, 2009 Nice... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.