decibel
07-11-2005, 04:23 AM
Hey guys, I'm looking for suggestions to calculate a "week of" function. Heres what i have below, and what im looking for is a better way to calculate "week of", any suggestions are welcome. Thanks in advance.
// this function gets the weekly label for file names and application display
// $dos is a unix timestamp stored for transaction dates
// currently, the function uses "sunday" to mark the start and end of a week, since transactions only occur monday thru friday, store hours.
function weekof($dos){
if($dos >= '1117324800' && $dos <= '1117929600'){
$weekof = "05 30 05-06 03 05";
}
if($dos >= '1117929600' && $dos <= '1118534400'){
$weekof = "06 06 05-06 10 05";
}
if($dos >= '1118534400' && $dos <= '1119139200'){
$weekof = "06 13 05-06 17 05";
}
if($dos >= '1119139200' && $dos <= '1119744000'){
$weekof = "06 20 05-06 24 05";
}
if($dos >= '1119744000' && $dos <= '1120348800'){
$weekof = "06 27 05-07 01 05";
}
if($dos >= '1120348800' && $dos <= '1120953600'){
$weekof = "07 04 05-07 08 05";
}
if($dos >= '1120953600' && $dos <= '1121558400'){
$weekof = "07 11 05-07 15 05";
}
if($dos >= '1121558400' && $dos <= '1122163200'){
$weekof = "07 18 05-07 22 05";
}
return $weekof;
}
$filename = "transactions-".$weekof.".dat";
// this function gets the weekly label for file names and application display
// $dos is a unix timestamp stored for transaction dates
// currently, the function uses "sunday" to mark the start and end of a week, since transactions only occur monday thru friday, store hours.
function weekof($dos){
if($dos >= '1117324800' && $dos <= '1117929600'){
$weekof = "05 30 05-06 03 05";
}
if($dos >= '1117929600' && $dos <= '1118534400'){
$weekof = "06 06 05-06 10 05";
}
if($dos >= '1118534400' && $dos <= '1119139200'){
$weekof = "06 13 05-06 17 05";
}
if($dos >= '1119139200' && $dos <= '1119744000'){
$weekof = "06 20 05-06 24 05";
}
if($dos >= '1119744000' && $dos <= '1120348800'){
$weekof = "06 27 05-07 01 05";
}
if($dos >= '1120348800' && $dos <= '1120953600'){
$weekof = "07 04 05-07 08 05";
}
if($dos >= '1120953600' && $dos <= '1121558400'){
$weekof = "07 11 05-07 15 05";
}
if($dos >= '1121558400' && $dos <= '1122163200'){
$weekof = "07 18 05-07 22 05";
}
return $weekof;
}
$filename = "transactions-".$weekof.".dat";