Skip to content

Instantly share code, notes, and snippets.

View thorne51's full-sized avatar

Chris Tiearney thorne51

  • Centurion, Gauteng, South Africa
View GitHub Profile
@thorne51
thorne51 / dates.php
Created July 29, 2015 08:44
Simple test to see what strtotime produces with 31st of a month going back in months with february which only has 28/29 days
<?php
echo '2015-07-28 -5 month: ' . date('Y-m-d', strtotime('2015-07-28 -5 month')) . "\r\n";
echo '2015-07-29 -5 month: ' . date('Y-m-d', strtotime('2015-07-29 -5 month')) . "\r\n";
echo '2015-07-30 -5 month: ' . date('Y-m-d', strtotime('2015-07-30 -5 month')) . "\r\n";
echo '2015-07-31 -5 month: ' . date('Y-m-d', strtotime('2015-07-31 -5 month')) . "\r\n";