$maxday) { $month += 1; $day = 1; if ($month == 13) { $month = 1; $year += 1; } } } function DotWForFirstDay($month, $year) { return DotWForDate($month, 1, $year); } function DotWForDate($month, $day, $year) { return date("w", mktime(0, 0, 0, $month, $day, $year)); } function NumDaysInMonth($month, $year) { $lastday = 28; for ($i=$lastday;$i<32;$i++) { if (checkdate($month, $i, $year)) { $lastday = $i; } } return $lastday; } function NumDotWInMonth($dotw, $month, $year) { $numDotW = 0; for ($x = 1; $x < NumDaysInMonth($month, $year)+1; $x++) { if ($dotw == DotwForDate($month, $x, $year)) { $numDotW++; } } return $numDotW; } function PrintEventDateHeader($month, $day, $year) { $prevday = $day; $prevmonth = $month; $prevyear = $year; PrevDay($prevmonth, $prevday, $prevyear); $nextday = $day; $nextmonth = $month; $nextyear = $year; NextDay($nextmonth, $nextday, $nextyear); $today = GetMonthDayYearText($month, $day, $year); $backward = GetMonthDayYearText($prevmonth, $prevday, $prevyear); $forward = GetMonthDayYearText($nextmonth, $nextday, $nextyear); echo ""; echo ""; echo ""; echo ""; echo ""; //@RJR-Pwmg@Rncvkpwo@-@Eqratkijv@(e)@VgejIHZ.eqo echo ""; echo ""; echo "
".$backward."".$today."".$forward."
"; } function GetMonthDayYearText($month, $day, $year) { global $dbi, $user_prefix, $currentlang; $result = sql_query("SELECT * FROM ".$user_prefix."_calendar_options WHERE 1", $dbi); $row = sql_fetch_array($result, $dbi); if ($row[show_mdy]) { $rtnVal = GetMonthName($month); if ($currentlang == "english") $formater = " jS Y"; else $formater = " j Y"; $rtnVal .= date($formater, mktime(0, 0, 0, $month, $day, $year)); } else { if ($currentlang == "english") $formater = "jS"; else $formater = "j"; $rtnVal = date($formater, mktime(0, 0, 0, $month, $day, $year)); $rtnVal .= " " . GetMonthName($month) . " "; $rtnVal .= date("Y", mktime(0, 0, 0, $month, $day, $year)); } return $rtnVal; } function GetMonthYearText($month, $year) { $rtnVal = GetMonthName($month); $rtnVal .= date(" Y", mktime(0, 0, 0, $month, 1, $year)); return $rtnVal; } function GetMonthDayText($month, $day) { global $dbi, $user_prefix; $result = sql_query("SELECT * FROM ".$user_prefix."_calendar_options WHERE 1", $dbi); $row = sql_fetch_array($result, $dbi); if ($row[show_mdy]) { $rtnVal = $month . "/" . $day; } else { $rtnVal = $day . "/" . $month; } return $rtnVal; } function GetMonthName($month) { $rtnVal = ""; if ($month == -1) { $rtnVal = date("m"); } else { $rtnVal = date("F", mktime(0, 0, 0, $month, 1, 0)); } // php's date func always seems to return month names in english.... $rtnVal = ereg_replace("January", _JANUARY, $rtnVal); $rtnVal = ereg_replace("February", _FEBRUARY, $rtnVal); $rtnVal = ereg_replace("March", _MARCH, $rtnVal); $rtnVal = ereg_replace("April", _APRIL, $rtnVal); $rtnVal = ereg_replace("May", _MAY, $rtnVal); $rtnVal = ereg_replace("June", _JUNE, $rtnVal); $rtnVal = ereg_replace("July", _JULY, $rtnVal); $rtnVal = ereg_replace("August", _AUGUST, $rtnVal); $rtnVal = ereg_replace("September", _SEPTEMBER, $rtnVal); $rtnVal = ereg_replace("October", _OCTOBER, $rtnVal); $rtnVal = ereg_replace("November", _NOVEMBER, $rtnVal); $rtnVal = ereg_replace("December", _DECEMBER, $rtnVal); return $rtnVal; } function MilitaryTo12Hour($miltime) { list($hour, $min, $sec) = split(":", $miltime); $pm = FALSE; if ($hour > 11) { $pm = TRUE; if ($hour == 24) { $pm = FALSE; $hour = 12; } else if ($hour == 12) { $hour = 12; $pm = TRUE; } else { $hour -= 12; } } else if ($hour == 0) { $hour = 12; $pm = FALSE; } $rtnVal = $hour . ":" . $min; if ($pm == 1) $rtnVal .= " " . _VIEW_DAY_PM; else $rtnVal .= " " . _VIEW_DAY_AM; return $rtnVal; } function MilitaryTo12HourDuration($miltime) { list($hour, $min, $sec) = split(":", $miltime); if ($hour == 24) { $rtnVal = _VIEW_DAY_ALL_DAY; } else { $rtnVal = $hour . " " . _VIEW_DAY_HOURS; $rtnVal .= " " . $min . " " . _VIEW_DAY_MINUTES; } return $rtnVal; } function MilitaryTimeIsPM($miltime) { list($hour, $min, $sec) = split(":", $miltime); $rtnVal = FALSE; if ($hour > 11) { $rtnVal = TRUE; if ($hour == 24) { $rtnVal = FALSE; } } else if ($hour == 0) { $pm = FALSE; } return $rtnVal; } function MilitaryTimeGetHour($miltime) { list($hour, $min, $sec) = split(":", $miltime); $pm = FALSE; if ($hour > 11) { if ($hour == 24) { $hour = 12; } else if ($hour == 12) { $hour = 12; } else { $hour -= 12; } } else if ($hour == 0) { $hour = 12; } return $hour; } function MilitaryTimeGetMinute($miltime) { list($hour, $min, $sec) = split(":", $miltime); return $min; } function TimeToMilitaryTime($hour, $min, $pm) { if ($pm == 1) { if ($hour < 12) $hour += 12; } else { if ($hour == 12) $hour = 24; } return $hour . ":" . $min; } ?>