本文整理汇总了PHP中findMonDate函数的典型用法代码示例。如果您正苦于以下问题:PHP findMonDate函数的具体用法?PHP findMonDate怎么用?PHP findMonDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findMonDate函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setToCurrentWeek
function setToCurrentWeek()
{
$_SESSION["todaydate"] = date('Ymd');
$_SESSION["mondate"] = findMonDate($_SESSION["todaydate"]);
$_POST["currentweek"] = null;
}
示例2: mysqli_connect
$servername = "localhost";
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$db_selected = "rbook_db";
$table = "conferenceroom";
$_SESSION["currenttable"] = $table;
// Establish connection to db
$conn = mysqli_connect($servername, $username, $password, $db_selected);
$_SESSION["conn"] = $conn;
// Set up inital date
if (!isset($_SESSION['todaydate'])) {
$_SESSION["todaydate"] = date('Ymd');
}
// Set up mondate if not already set from next week/previous week functions
if (!isset($_SESSION['mondate'])) {
$_SESSION['mondate'] = findMonDate($_SESSION['todaydate']);
}
// function to calculate next date
// given a date
// dates are given in format YYYYMMDD
function findNextDate($date)
{
// check date string is right length
if (strlen($date) == 8) {
// first 4 digits -> year
$year = substr($date, 0, 4);
$month = substr($date, 4, 2);
$day = substr($date, 6, 2);
} else {
return "Error: string of wrong length";
}