Jump to content

[SOLVED] Simple Date question


phpretard

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/160904-solved-simple-date-question/
Share on other sites

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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.