Created
August 3, 2012 21:07
-
-
Save ekelleyv/3251546 to your computer and use it in GitHub Desktop.
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 | |
function getQuarter() { | |
$monthNumber = intval(date("m")); | |
return floor(($monthNumber - 1) / 3) + 1; | |
} | |
function buildWeek() { | |
if (date('l') == "Sunday") { | |
$sundayTime = time(); | |
} | |
else { | |
$sundayTime = strtotime('last sunday'); | |
} | |
$WY = date("Y", $sundayTime); | |
$WM = date("m", $sundayTime); | |
$WD = date("d", $sundayTime); | |
return sprintf("WY:%s;WM:%s;WD:%s;", $WY, $WM, $WD); | |
} | |
function getTimeString() { | |
return sprintf("Y:%s;Q:%s;M:%s;%sD:%s;H:%s", date("Y"), getQuarter(), date("m"), buildWeek(), date("d"), date("H")); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment