Home PHP Libraries Other libraries PHP small calendar class library
PHP small calendar class library
<?php
// file:calendar.class.php 日历类原文件
error_reporting(0);
class Calendar{
  private $year;
  private $month;
  private $start_weekday; //当月的第一天对应的是周几,作为当月开始遍历日期的开始
  private $days; //当前月总天数
//构造方法,用来初使化一些日期属性
  function __construct(){
//如果用户没有设置所份数,则使用当前系统时间的年份
    $this->year = isset($_GET["year"]) ? $_GET["year"] : date("Y");
//如果用户没有设置月份数,则使用当前系统时间的月份
    $this->month = isset($_GET["month"]) ? $_GET["month"] : date("m");
//通过具体的年份和月份,利用date()函数的w参数获取当月第一天对应的是周几
    $this->start_weekday = date("w",mktime(0,0,0,$this->month,1,$this->year));
//通过具体的年份和月份,利用date()函数的t参数获取当月的天数
    $this->days = date("t",mktime(0,0,0,$this->month,1,$this->year));
  }

Calendar is a daily-use publication used to record dates and other related information. One that displays information for one day on each page is called a calendar, one that displays information for one month on each page is called a monthly calendar, and one that displays information for a whole year on each page is called an annual calendar. There are many forms, such as wall calendars, desk calendars, annual calendar cards, etc., and now there are electronic calendars.

China first had a calendar about four thousand years ago. According to a page of the oracle bone calendar in the oracle bone inscriptions, it is proved that the calendar of the Yin Dynasty has reached a considerable level. This page of the oracle bone calendar is the oldest physical almanac in all mankind. This page of the oracle bone calendar is also called a calendar.


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP calls the dll class library method developed by C#, _PHP tutorial PHP calls the dll class library method developed by C#, _PHP tutorial

13 Jul 2016

PHP calls the dll class library method developed in C#. PHP calls dll class library methods developed in C#. Sometimes, we need to use dll class libraries written in other languages ​​in php, such as dlls written in C#. The method is to use the PHP new COM method to call.

laravel - What should the standardized PHP class library naming look like? laravel - What should the standardized PHP class library naming look like?

06 Jul 2016

I have seen many open source projects in the form of class.classname.php, but I have also seen many frameworks in the form of classname.class.php. Where should I place this class? I personally prefer the .class.php form, because in some frameworks, after importing third-party class libraries and specifying class libraries...

100 commonly used PHP class library resources and techniques 100 commonly used PHP class library resources and techniques

14 Mar 2018

Collect and organize some commonly used PHP class libraries, resources and techniques. In order to quickly find what you need at work, this article mainly shares with you 100 commonly used PHP class library resources and techniques, hoping to help everyone.

Getting started with PHP crawlers: How to choose the right class library? Getting started with PHP crawlers: How to choose the right class library?

09 Aug 2023

Getting started with PHP crawlers: How to choose the right class library? With the rapid development of the Internet, a large amount of data is scattered across various websites. In order to obtain this data, we often need to use crawlers to extract information from web pages. As a commonly used web development language, PHP also has many class libraries suitable for crawlers to choose from. However, there are some key factors to consider when choosing a library that suits your project needs. Functional richness: Different crawler libraries provide different functions. Some libraries can only be used for simple web scraping, while others

php calendar class calendar control php calendar class calendar control

25 Jul 2016

php calendar class calendar control

XML operation class implemented by PHP [XML Library] XML operation class implemented by PHP [XML Library]

06 Jan 2017

This article mainly introduces the XML operation class implemented by PHP, involving PHP's conversion, serialization, deserialization and other related operation skills for arrays and xml. Friends in need can refer to the following

See all articles