I have been racking my brain trying to get this function to work properly and it is doing so for everything but Sundays. What I am trying to do is display all dates within a specified date range that fall within a selected day of the week (ie. Monday,etc). This function serves multiple purposes where it can be used for just one day of the week, for all weekdays, or weekends. Everything works but Sundays do not show up. Can anyone please help or suggest any other function that will accomplish what I am trying to do?
Here is the code:
function getDOW($moBeg, $dayBeg, $moEnd, $dayEnd, $year, $dayWeek) {
$week = 0;
$dayBeg = $dayBeg - 1;
$DOW = array();
$i = 1;
//Get first date of specified day from the beginning of the date range
if ($dayWeek == 0){
$week = date("w", mktime(12, 0, 0, $moBeg, $dayBeg, $year));
}
else {
while ($week != $dayWeek) { //Specify the day of the week (ie. Monday = 1)
$dayBeg++;
$week = date("w", mktime(12, 0, 0, $moBeg, $dayBeg, $year));
}
}
array_push($DOW,date("Ymd", mktime(12, 0, 0, $moBeg, $dayBeg, $year)));
$weekBeg = date("W", mktime(12, 0, 0, $moBeg, $dayBeg, $year));
$weekEnd = date("W", mktime(12, 0, 0, $moEnd, $dayEnd, $year));
while ($weekNum < $weekEnd) {
$addWeek = strtotime(date("r", mktime(12, 0, 0, $moBeg, $dayBeg, $year)) . "+" . $i . " week");
$addWeekConv = date("Ymd", $addWeek);
$weekNum = date("W", $addWeek);
if (substr($addWeekConv,0,4) == $year && substr($addWeekConv,4,2) <= $moEnd){
//Conditional fixes problem where an extra date from next month or year is added
array_push($DOW,$addWeekConv);
$i++;
}
}
return $DOW;
}
returning data from an ssh2_exec()
here's what i got.$conn = ssh2_connect($this->_host); ssh2_auth_password($conn,$this->_user,$this->_pass)or die("Cannot Connect"); //build command line to include
noob cURL help
I have a pretty basic form that I need to cURL post to a file in my includes folder (includes/login.inc.php). I have never used cURL and cant find any good tutorials online so you guys are my last
parsing error
can anyone explain this syntax error:Parse error: syntax error, unexpected T_IFThe error is occuring at the blank field check ie: if (!$_POST['username]...etc etc//check if form has been submittedif
styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those. I have the relevent html but not able to come up with the css. please helpthxview plaincopy to
exclude characters from counting?
Hello, I wanted to ask if you have a string like:Code: $my_s='ASRGREGTGTR----REGREGRE+++RRRRRR....';is there a way to count the length of the string, excluding non-word characters (+,- or .)?thank you
Problem with HTTP Caching...?
Hi there, im trying to implement caching. But it doesn't always work.I post it here because there is no Client-Side HTTP topic...Code: private function setLastModified ($aTimestamp) {
How can I uploading Transactional Data from Legacy to New SAP system
Hell Gurus,
Problem with a select distinct
I have a problema with a select distinct, I have the next sql:
Trouble checking SESSION cookie
I am trying to use $_SESSION cookies to verify admin privileges .I don't understand why this is not working:/*everything above here is working*/ $session = mysql_fetch_array($session_query); $type =
Help uploading .JPG
I have a problem with upload images when the ending is .JPG capitalized.. I really don't know what causes it to crash but been testing it for some time and it's my retrictions that won't allow it in.