当前位置: 首页>>代码示例>>PHP>>正文


PHP cal_days_in_month函数代码示例

本文整理汇总了PHP中cal_days_in_month函数的典型用法代码示例。如果您正苦于以下问题:PHP cal_days_in_month函数的具体用法?PHP cal_days_in_month怎么用?PHP cal_days_in_month使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cal_days_in_month函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($month, $year)
 {
     parent::__construct();
     $this->year = $year;
     $this->month = $month;
     $this->daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
 }
开发者ID:evandrolacerda,项目名称:caps_laravel,代码行数:7,代码来源:GeradorFolhaFrequencia.php

示例2: GetEventsForMonth

 function GetEventsForMonth($year, $month, $employeeId, $categoryId)
 {
     $monthStartString = $year . '-' . $month . '-1' . ' 00:00:00';
     $totalDays = cal_days_in_month(CAL_GREGORIAN, $month, $year);
     $monthEndString = $year . '-' . $month . '-' . $totalDays . ' 23:59:59';
     return $this->GetEventsForTimePeriod($monthStartString, $monthEndString, $employeeId, $categoryId);
 }
开发者ID:paul-hudlow,项目名称:ksu-6623-project,代码行数:7,代码来源:EventData.php

示例3: make_days_array

 function make_days_array($year, $month)
 {
     // Calculate the number of days in the selected month
     $num_days_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
     // Make $this->days array containing the Day Number and Day Number in the selected month
     for ($i = 1; $i <= $num_days_month; $i++) {
         // Work out the Day Name ( Monday, Tuesday... ) from the $month and $year variables
         $d = mktime(0, 0, 0, $month, $i, $year);
         // Create the array
         $this->days[] = array("daynumber" => $i, "dayname" => date("l", $d));
     }
     /*	
     Sample output of the $this->days array:
     
     [0] => Array
             (
                 [daynumber] => 1
                 [dayname] => Monday
             )
     
         [1] => Array
             (
                 [daynumber] => 2
                 [dayname] => Tuesday
             )
     */
     $this->make_blank_start($year, $month);
     $this->make_blank_end($year, $month);
 }
开发者ID:Antrep,项目名称:Bali-Travel-Stay,代码行数:29,代码来源:class_calendar.php

示例4: days

 public static function days($month, $year = FALSE)
 {
     if ($year === FALSE) {
         $year = date('Y');
     }
     return cal_days_in_month(CAL_GREGORIAN, $month, $year);
 }
开发者ID:noikiy,项目名称:kohana,代码行数:7,代码来源:Date.php

示例5: actionMonthStorage

 public function actionMonthStorage()
 {
     $dates = explode('-', $_POST['dates']);
     $depId = $_POST['depId'];
     $number = cal_days_in_month(CAL_GREGORIAN, $dates[1], $dates[0]);
     $realized = array();
     $expense = new Expense();
     $expenses = array();
     $startCount = array();
     $endCount = array();
     $depRealize = new DepFaktura();
     $inexp = new Expense();
     $balance = new Balance();
     for ($i = 1; $i <= $number; $i++) {
         $tempDate = $dates[0] . "-" . $dates[1] . "-" . $i;
         $listDate[$i] = $tempDate;
         $realized[$tempDate] = $depRealize->getDepRealizesSumm($tempDate, $depId);
         $expenses[$tempDate] = $expense->getDepCost($depId, $tempDate);
         $tempBalance = $balance->getDepBalanceSumm($tempDate, $depId);
         $startCount[$tempDate] = $tempBalance[0];
         $endCount[$tempDate] = $tempBalance[1];
         $curEndCount[$tempDate] = $tempBalance[2];
     }
     $this->renderPartial('monthStorage', array('tempDate' => $listDate, 'realized' => $realized, 'expenses' => $expenses, 'startCount' => $startCount, 'endCount' => $endCount, 'curEndCount' => $curEndCount, 'depId' => $depId));
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:25,代码来源:DepStorageController.php

示例6: visitorAction

 public function visitorAction()
 {
     $request = $this->getRequest();
     $session = $request->getSession();
     $ip = $_SERVER['REMOTE_ADDR'];
     $time = time();
     $session = $this->getRequest()->getSession();
     $session_visitor = $session->get('visitor');
     $session_visitor_day = $session->get('visitor_day');
     if (!isset($session_visitor_day)) {
         $session->set("visitor_day", $time);
     } else {
         if (!isset($session_visitor)) {
             // insert him into the database and create a session
             $this->createVisitor($ip, $time);
             $session->set("visitor", $time);
         } else {
             //Check for daily stats first
             if (!($session_visitor > time() - 86400 * cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y")))) {
                 $session->set("visitor_day", $time);
             }
             if (!($session_visitor > time() - 600)) {
                 $this->createVisitor($ip, $time);
                 $session->set("visitor", $time);
             }
         }
     }
     $session->save();
     session_write_close();
     return new Response(json_encode(array("success" => true)));
 }
开发者ID:c4d3r,项目名称:mcsuite-application-eyeofender,代码行数:31,代码来源:StatisticController.php

示例7: get_billing_info

 function get_billing_info($account_id = SES_COMP)
 {
     App::import('Model', 'UserSubscription');
     $usersub = new UserSubscription();
     $user_sub = $usersub->find('first', array('conditions' => array('company_id' => $account_id), 'order' => 'id DESC'));
     $pmonth = date('m', strtotime('-1 month', strtotime($user_sub['UserSubscription']['next_billing_date'])));
     $pyear = date('Y', strtotime('-1 month', strtotime($user_sub['UserSubscription']['next_billing_date'])));
     $mdays = cal_days_in_month(CAL_GREGORIAN, $pmonth, $pyear);
     if (strtotime($user_sub['UserSubscription']['sub_start_date']) + $mdays * 24 * 60 * 60 < strtotime($user_sub['UserSubscription']['next_billing_date'])) {
         $dt_chk = date('Y-m-d H:i:s', strtotime($user_sub['UserSubscription']['next_billing_date']) - $mdays * 24 * 60 * 60);
     } else {
         $dt_chk = $user_sub['UserSubscription']['sub_start_date'];
     }
     App::import('Model', 'CompanyUser');
     $compuser = new CompanyUser();
     //$counter = $compuser->find('count',array('conditions'=>array('company_id'=>$account_id,'created <'=>$dt_chk,'(is_active=1 OR is_active=2)')));
     //$user_info =  $compuser->find('all',array('conditions'=>array('company_id'=>$account_id,'created >'=>$dt_chk,'(is_active=1 OR is_active=2)'),'group'=>array('DATE(created)'),'fields'=>array('DATE(created) AS dt','DATE(modified) AS mfd_dt','COUNT(id) as cnt','SUM(est_billing_amt) AS amnt')));
     //$delted_users =  $compuser->find('all',array('conditions'=>array('company_id'=>$account_id,'is_active'=>3,'OR'=>array('created >'=>$dt_chk,'modified >'=>$dt_chk)),'group'=>array('dt','DATE(modified)'),'fields'=>array("IF((created > '".$dt_chk."'),DATE(created),'".date('Y-m-d',strtotime($dt_chk))."') AS dt",'DATE(modified) AS mfd_dt','COUNT(id) as cnt','SUM(est_billing_amt) AS amnt')));
     $counter = $compuser->find('count', array('conditions' => array('company_id' => $account_id, 'is_active' => 1)));
     $invited_users = $compuser->find('count', array('conditions' => array('company_id' => $account_id, 'is_active' => 2)));
     $disabled_users = $compuser->find('count', array('conditions' => array('company_id' => $account_id, 'is_active' => 0, 'billing_end_date >= ' => GMT_DATE)));
     $deleted_users = $compuser->find('count', array('conditions' => array('company_id' => $account_id, 'is_active' => 3, 'billing_end_date >= ' => GMT_DATE)));
     //$user_info =  $compuser->find('all',array('conditions'=>array('company_id'=>$account_id,'created >'=>$dt_chk,'(is_active=1 OR is_active=2)'),'group'=>array('DATE(created)'),'fields'=>array('DATE(created) AS dt','DATE(modified) AS mfd_dt','COUNT(id) as cnt','SUM(est_billing_amt) AS amnt')));
     //$delted_users =  $compuser->find('all',array('conditions'=>array('company_id'=>$account_id,'is_active'=>3,'OR'=>array('created >'=>$dt_chk,'modified >'=>$dt_chk)),'group'=>array('dt','DATE(modified)'),'fields'=>array("IF((created > '".$dt_chk."'),DATE(created),'".date('Y-m-d',strtotime($dt_chk))."') AS dt",'DATE(modified) AS mfd_dt','COUNT(id) as cnt','SUM(est_billing_amt) AS amnt')));
     //$user_info['previous_users'] =$counter;
     //$user_info['delted_users'] =$delted_users;
     $user_info['active_users'] = $counter;
     $user_info['invited_users'] = $invited_users;
     $user_info['disabled_users'] = $disabled_users;
     $user_info['deleted_users'] = $deleted_users;
     return $user_info;
     //echo "<pre>";print_r($user_info);exit;
 }
开发者ID:jgera,项目名称:orangescrum,代码行数:33,代码来源:User.php

示例8: months

 public function months()
 {
     $folder_params = $this->fetchParam("folders");
     $year_params = $this->fetchParam("year");
     $folders = $this->cleanFoldersList($folder_params);
     $filenames = $this->scanDirectory($folders);
     $sort = $this->fetchParam("sort");
     //extract all years from all filenames
     foreach ($filenames as $file) {
         $year = substr($file, 0, 4);
         $month = substr($file, 5, 2);
         if ($year == $year_params) {
             $months_array[] = $month;
         }
     }
     //get unique year entries and counts.
     $months = array_unique($months_array);
     rsort($months);
     if ($sort == 'asc') {
         $months = array_reverse($months);
     }
     $counts = array_count_values($months_array);
     $total = array_sum($counts);
     $return_array['total'] = $total;
     //create return array
     foreach ($months as $month) {
         $return_array['months'][] = array('month' => $month, 'month_text' => date('F', mktime(0, 0, 0, $month, 10)), 'year' => $year_params, 'count' => $counts[$month], 'days_in_month' => cal_days_in_month(CAL_GREGORIAN, $month, $year_params));
     }
     return $return_array;
 }
开发者ID:roobottom,项目名称:roobottom-statamic,代码行数:30,代码来源:pi.archive.php

示例9: VisionAccueilAction

 public function VisionAccueilAction(Request $request, $month, $year)
 {
     if ($this->getUser()->getAgent()->getService()->getId() != 13) {
         throw new AccessDeniedException("Vous n'êtes pas autorisé à acceder à cette page");
     }
     //récupération EntityManager
     $em = $this->getDoctrine()->getManager();
     //récupération de tout les agents
     $repositoryUser = $em->getRepository('OCUserBundle:User');
     $users = $repositoryUser->findAll();
     $repositoryEvent = $em->getRepository("OCCalendrierBundle:Event");
     $events = $repositoryEvent->findAbsenceByMonthAndYear($month, $year);
     $repositoryHSF = $em->getRepository("OCCalendrierBundle:HeureSupFrac");
     $HSF = $repositoryHSF->findByHSFMonthAndYear($month, $year);
     $repositoryServices = $em->getRepository("OCAgentBundle:Service");
     $services = $repositoryServices->findAll();
     $repositoryCategory = $em->getRepository("OCCalendrierBundle:Category");
     $Categories = $repositoryCategory->findAll();
     $repositoryCategoryhsf = $em->getRepository("OCCalendrierBundle:CategoryHSF");
     $Categorieshsf = $repositoryCategoryhsf->findAll();
     $JoursDansMois = cal_days_in_month(CAL_GREGORIAN, $month, $year);
     $defaultData = array('message' => 'Type your message here');
     $form = $this->createFormBuilder($defaultData)->add('month', 'choice', array('choices' => array('01' => 'Janvier', '02' => 'Fevrier', '03' => 'Mars', '04' => 'Avril', '05' => 'Mai', '06' => 'Juin', '07' => 'Juillet', '08' => 'Aout', '09' => 'Septembre', '10' => 'Octobre', '11' => 'Novembre', '12' => 'Decembre')))->add('year', 'choice', array('choices' => array(date('Y') - 2 => date('Y') - 2, date('Y') - 1 => date('Y') - 1, date('Y') => date('Y'), date('Y') + 1 => date('Y') + 1), 'preferred_choices' => array(date('Y'))))->add('AllerA', 'submit')->getForm();
     $form->handleRequest($request);
     if ($form->isValid()) {
         $data = $form->getData();
         $JoursDansMois = cal_days_in_month(CAL_GREGORIAN, $form["month"]->getData(), $form["year"]->getData());
         return $this->redirect($this->generateUrl('oc_vision_cla_homepage', array('month' => $form["month"]->getData(), 'year' => $form["year"]->getData())));
     }
     //var_dump($events[1]);
     return $this->render("OCVisionCLABundle:VisionCla:VisionClaAccueil.html.twig", array('month' => $month, 'year' => $year, 'events' => $events, 'tabHSF' => $HSF, 'users' => $users, 'services' => $services, 'Categories' => $Categories, 'Categorieshsf' => $Categorieshsf, 'JoursDansMois' => $JoursDansMois, 'form' => $form->createView(), 'user' => $this->getUser()));
 }
开发者ID:guich25,项目名称:AppConge,代码行数:32,代码来源:DefaultController.php

示例10: inputTanggal

function inputTanggal($dn, $val = "0000-00-00", $cb = "")
{
    global $MNTHN;
    $tgl = explode("-", $val);
    $s = "";
    if (intval($tgl[1]) != 0) {
        $dim = cal_days_in_month(CAL_GREGORIAN, intval($tgl[1]), intval($tgl[0])) + 1;
    } else {
        $dim = 32;
    }
    $s .= "<input type=\"hidden\" id=\"" . $dn . "\" name=\"" . $dn . "\" value=\"" . $val . "\" />";
    $s .= "<input type=\"hidden\" id=\"" . $dn . "f\" name=\"" . $dn . "f\" value=\"" . $val . "\" />";
    $s .= "<input type=\"hidden\" id=\"" . $dn . "s\" name=\"" . $dn . "s\" value=\"" . $val . "\" />";
    $s .= "<select class=\"iSelect\" id=\"" . $dn . "_m\" name=\"" . $dn . "_m\" onchange=\"inputdateChange('" . $dn . "');" . $cb . "\" onfocus=\"this.className='iSelectx'\" onblur=\"this.className='iSelect'\"><option value=\"0\">month:</option>";
    for ($kk = 1; $kk <= 12; $kk++) {
        $s .= "<option value=\"" . $kk . "\" " . ($kk == $tgl[1] ? "selected" : "") . " >" . $MNTHN[$kk] . "</option>";
    }
    $s .= "</select>";
    $s .= "<select class=\"iSelect\" id=\"" . $dn . "_d\" name=\"" . $dn . "_d\" style=\"margin-left:2px\" onchange=\"inputdateChange('" . $dn . "');" . $cb . "\" onfocus=\"this.className='iSelectx'\" onblur=\"this.className='iSelect'\"><option value=\"0\">date:</option>";
    for ($kk = 1; $kk < $dim; $kk++) {
        $s .= "<option value=\"" . $kk . "\" " . ($kk == $tgl[2] ? "selected" : "") . " >" . $kk . "</option>";
    }
    $s .= "</select> , ";
    $s .= "<select class=\"iSelect\" id=\"" . $dn . "_y\" name=\"" . $dn . "_y\" style=\"margin-left:2px\" onchange=\"inputdateChange('" . $dn . "');" . $cb . "\" onfocus=\"this.className='iSelectx'\" onblur=\"this.className='iSelect'\"><option value=\"0\">year:</option>";
    for ($kk = intval(date("Y")) + 2; $kk >= 1945; $kk--) {
        $s .= "<option value=\"" . $kk . "\" " . ($kk == $tgl[0] ? "selected" : "") . " >" . $kk . "</option>";
    }
    $s .= "</select>";
    return $s;
}
开发者ID:epiii,项目名称:siadu-epiii,代码行数:30,代码来源:control.php

示例11: getBudgetData

 public function getBudgetData($app, $year = 2016, $month = 8)
 {
     $startDate = $year . "/" . $month . "/1";
     $endDate = $year . "/" . ($month + 1) . "/1";
     $budgets = $this->db->query($this->qb->table($this->table)->where("start_date", ">=", $startDate)->andWhere("start_date", "<", $endDate)->andWhere("user_id", "=", $app->auth->user_id)->get())->result();
     foreach ($budgets as $budget) {
         $budgetTags = $app->BudgetTag->find('all', ["where" => ["bud_id", "=", $budget->id]]);
         $tags = [];
         foreach ($budgetTags as $tag) {
             $tags[] = $app->Tags->find('all', ["where" => ["id", "=", $tag->tag_id]]);
         }
         $spent = $app->ExpTags->expTagsTotalSpent($app->auth->user_id, $startDate, $endDate, $tags);
         $exptags = [];
         foreach ($tags as $tagone) {
             foreach ($tagone as $tag) {
                 $tagInfo = $app->Tags->find();
                 $amount = (int) $this->db->query("SELECT Sum(exp.cost ) as total FROM exp_tags as tag,expenses as exp where tag_id = ? and exp.exp_id = tag.exp_id and  exp.date >= ? and exp.date < ? and exp.user_id = ?", [$tag->id, $startDate, $endDate, $app->auth->user_id])->first()->total;
                 if ($amount > 0) {
                     $exptags[$tag->name] = $amount;
                 }
             }
         }
         $budgetDate = new Carbon($budget->start_date, 'Australia/Perth');
         //perth time zone
         $budget->tags = $exptags;
         $budget->spent = $spent;
         $budget->spentPercentage = number_format($spent / $budget->amount * 100, 2, '.', ',');
         $budget->future = Carbon::now('Australia/Perth')->lt($budgetDate);
         $budget->spendingLeft = $budget->future == true ? ($budget->amount - $spent) / cal_days_in_month(CAL_GREGORIAN, $month, $year) : number_format(($budget->amount - $spent) / (cal_days_in_month(CAL_GREGORIAN, $month, $year) - (int) date('j')), 2, '.', ',');
         $budget->expired = Carbon::now('Australia/Perth')->gt($budgetDate->addMonth());
         $budget->saved = $budget->amount - $spent > 0 ? number_format($budget->amount - $spent, 2, '.', ',') : number_format($spent - $budget->amount, 2, '.', ',');
     }
     return $budgets;
 }
开发者ID:tawazz,项目名称:spendee,代码行数:34,代码来源:budget.php

示例12: getMonthDays

function getMonthDays($days)
{
    $workdays = array();
    $type = CAL_GREGORIAN;
    $month = date('n');
    // Month ID, 1 through to 12.
    $year = date('Y');
    // Year in 4 digit 2009 format.
    $day_count = cal_days_in_month($type, $month, $year);
    // Get the amount of days
    //loop through all days
    for ($i = 1; $i <= $day_count; $i++) {
        $date = $year . '/' . $month . '/' . $i;
        //format date
        $get_name = date('l', strtotime($date));
        //get week day
        $day_name = substr($get_name, 0, 3);
        // Trim day name to 3 chars
        //if not a weekend add day to array
        if ($day_name != 'Sun' && $day_name != 'Sat') {
            $workdays['workdays'][] = $i;
        } else {
            $workdays['weekends'][] = $i;
        }
    }
    return $workdays[$days];
}
开发者ID:puuble,项目名称:shoutcastRipper,代码行数:27,代码来源:index.php

示例13: buildCalendar

function buildCalendar($month, $year)
{
    // It's not generally a good idea to use global variables but it works
    global $names;
    $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
    $firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year);
    // -1 is to make the day of week start from 0 (so that it is more natural to work with, using arrays)
    $dayOfWeek = getdate($firstDayOfMonth)["wday"] - 1;
    $calendar = "<table class=\"calendar\">\n        <caption>" . $names["months"][$month - 1] . "</caption><thead><tr>";
    foreach ($names["days"] as $day) {
        $calendar .= "<th class=\"header\">" . $day . "</th>";
    }
    $currentDay = 1;
    $calendar .= "</tr></thead><tbody><tr>";
    if ($dayOfWeek > 0) {
        $calendar .= "<td colspan=\"" . $dayOfWeek . "\"></td>";
    }
    while ($currentDay <= $daysInMonth) {
        if ($dayOfWeek == 7) {
            $dayOfWeek = 0;
            $calendar .= "</tr><tr>";
        }
        $calendar .= "<td>" . $currentDay . "</td>";
        $currentDay++;
        $dayOfWeek++;
    }
    if ($dayOfWeek != 7) {
        $calendar .= "<td colspan=\"" . (7 - $dayOfWeek) . "\"></td>";
    }
    $calendar .= "</tr></tbody></table>";
    return $calendar;
}
开发者ID:KatyaMarincheva,项目名称:SoftUni-Homeworks,代码行数:32,代码来源:AwesomeCalendar.php

示例14: pc_get_days_in_month

function pc_get_days_in_month()
{
    global $wp_locale;
    $month = date('n');
    $day_in_month = cal_days_in_month(CAL_GREGORIAN, $month, date('Y'));
    return $days_in_month;
}
开发者ID:picpen,项目名称:courage-thru-christ,代码行数:7,代码来源:progress-calendar.php

示例15: render

 public function render()
 {
     // metoda koja iscrtava kalendar
     $start = date('w', mktime(0, 0, 0, $this->month, 1, $this->year));
     // pozicija prvoj u mesecu koji se crta
     $days_in_month = cal_days_in_month(CAL_GREGORIAN, $this->month, $this->year);
     // broj dana u mesec koji se crta
     $same_week = 7;
     // promenljiva vodi računa o kraju nedelje
     echo "<table>";
     echo "<tr><td>Mesec: </td><th id='month-title'>{$this->month}</th><td>Godina: </td><th id='year-title'>{$this->year}</th></tr>";
     echo "<tr><td>Nedlja</td><td>Ponedeljak</td><td>Utorak</td><td>Sreda</td><td>Četvrtak</td><td>Petak</td><td>Subota</td><tr>";
     echo "<tr>";
     for ($i = 0; $i < $start; $i++) {
         // prazna polja pre prvog u mesecu
         echo "<td></td>";
         $same_week--;
     }
     for ($i = 1; $i <= $days_in_month; $i++) {
         if ($i == $this->date->format('j') && $this->month == $this->date->format('m') && $this->year == $this->date->format('Y')) {
             echo "<td id='today'>{$i}</td>";
             // današnji dan dobija id "today"
         } else {
             echo "<td>{$i}</td>";
         }
         $same_week--;
         if (!$same_week) {
             // ukoliko je kraj nedelje, novi red
             echo "</tr><tr>";
             $same_week = 7;
         }
     }
     echo "</tr></table>";
 }
开发者ID:jeffsouln,项目名称:kud_zad,代码行数:34,代码来源:functions.php


注:本文中的cal_days_in_month函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。