Created
May 31, 2012 12:08
-
-
Save sergejmueller/2842988 to your computer and use it in GitHub Desktop.
Korrekte Ermittlung des letzten Monats am 31. eines Monats. Nur für PHP 5.3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Heute ist der 31. Mai */ | |
$t = strtotime('-1 month'); | |
echo strftime('%e. %B', $t); | |
// Ausgabe: 1. May | |
$t = strtotime('first day of previous month'); | |
echo strftime('%e. %B', $t); | |
// Ausgabe: 1. April |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment