Home Backend Development PHP Tutorial PHP 日期函数说明

PHP 日期函数说明

Jun 23, 2016 pm 01:19 PM

在页面的最前页加上date_default_timezone_set(PRC);   /*把时间调到北京时间,php5默认为格林威治标准时间*/date ()date():a:   "am"或是"pm" A:   "AM"或是"PM" d:   几日,两位数字,若不足则补零;从"01"至"31" D:    星期几,3个英文字母,如:"Fri" F:    月份,英文全名,如:"January" h:    12小时制的小时,从"01"至"12" H:    24小时制的小时,从"00"至"23" g:    12小时制的小时,不补零;从"1"至"12" G:    24小时制的小时,不补零;从"0"至"23" j:    几日,不足不被零;从"1"至"31" l:    星期几,英文全名,如:"Friday" m:    月份,两位数字,从"01"至"12" n:    月份,两位数字,不补零;从"1"至"12" M:    月份,3个英文字母;如:"Jan" s:   秒;从"00"至"59" S:    字尾加英文序数,两个英文字母,如:"21th" t:    指定月份的天数,从"28"至"31" U:    总秒数 w:    数字型的星期几,从"0(星期天)"至"6(星期六)" Y:    年,四位数字 y:    年,两位数字 z: 一年中的第几天;从"1"至"366"mktime()://函数返回一个日期的 Unix 时间戳。//参数总是表示 GMT 日期,因此 is_dst 对结果没有影响。mktime(hour,minute,second,month,day,year,is_dst)hour:    可选。规定小时。    minute:  可选。规定分钟。    second:  可选。规定秒。    month:   可选。规定用数字表示的月。    day:     可选。规定天。    year:    可选。规定年。在某些系统上,合法值介于 1901 - 2038 之间。不过在 PHP 5 中已经不存在这个限制了。    is_dst:  可选。如果时间在日光节约时间(DST)期间,则设置为1,否则设置为0,若未知,则设置为-1。          自 5.1.0 起,is_dst 参数被废弃。因此应该使用新的时区处理特性。
Copy after login






























Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

6 Extra Skills Every PHP Developer Should Have 6 Extra Skills Every PHP Developer Should Have Feb 28, 2025 am 10:52 AM

6 Extra Skills Every PHP Developer Should Have

Understand Arrays in PHP Understand Arrays in PHP Feb 28, 2025 am 10:53 AM

Understand Arrays in PHP

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

See all articles