Barand Posted January 29, 2019 Share Posted January 29, 2019 If you had used it on the 26th November, 2018 it would Quote Link to comment Share on other sites More sharing options...
Paul-D Posted January 29, 2019 Author Share Posted January 29, 2019 Do I relay have to do all this in PHP 5.0? <?php $Date = time(); $Month = date('m' ,$Date); $Year = date('Y' ,$Date); $Month -= 1; if ($Month == 0) { $Month = 12; $Year -= 1; } $Date = $Year . "-" . $Month . "-01"; echo $Date; ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted January 29, 2019 Share Posted January 29, 2019 Either that or do this echo date('Y-m-d', strtotime('first day of last month')); // 2018-12-01 Quote Link to comment Share on other sites More sharing options...
Paul-D Posted January 30, 2019 Author Share Posted January 30, 2019 (edited) Thanks echo date('Y-m-d', strtotime('first day of last month')); is beeter than $date = new DateTime('first day of last month'); But how do I get a php.ini into the system for future class related programming I have [Date] date.timezone=Europe/London Will it be picked up automatically or as a shared server be ignored? Edited January 30, 2019 by Paul-D Quote Link to comment Share on other sites More sharing options...
Barand Posted January 30, 2019 Share Posted January 30, 2019 First step is look at the output from phpinfo() That will tell you the location of the ini file that is being used and your current settings Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 30, 2019 Share Posted January 30, 2019 As I had to do, you should contact your hosting support people and TELL them you want your PHP.ini file to indicate the timezone that you want to default to. Then you'll never have to worry about it again. If they tell you that you can't have it that way, then tell them to give you a FULL copy of the existing .ini file that is in use where you can access it and make the change(s) you need. Be careful though! 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.