


disk error press any key to re Arrangement of parameters related to date function in PHP
Add
date_default_timezone_set(PRC) to the front page of the page; /*Adjust the time to Beijing time, php5 defaults to Greenwich Mean Time*/
date ()
a: "am" or "pm"
A: "AM" or "PM"
d: Day, two digits, zero if missing; from "01" to "31"
D: Day of the week, 3 English letters, such as: "Fri"
F : month, full English name, such as: "January"
h: hour in 12-hour format, from "01" to "12"
H: hour in 24-hour format, from "00" to "23"
g: 12 Hours in hourly format, do not add zeros; from "1" to "12"
G: Hours in 24-hour format, do not add zeros; from "0" to "23"
j: Days, any deficiency will not be zeroed; from "1" to "31"
l: day of the week, full English name, such as: "Friday"
m: month, two digits, from "01" to "12"
n: month, two digits, no padding Zero; from "1" to "12"
M: month, 3 English letters; such as: "Jan"
s: seconds; from "00" to "59"
S: add an English ordinal at the end of the word, two English letters Letters, such as: "21th"
t: Specify the number of days in the month, from "28" to "31"
U: Total seconds
w: Numeric day of the week, from "0 (Sunday)" to "6 (Saturday) )"
Y: year, four digits
y: year, two digits
z: day of the year; from "1" to "366"
============ ================================================== ====
1, year-month-day
indicates the year with uppercase Y and lowercase y;
indicates the month with uppercase F, uppercase M, lowercase m and lowercase n (two ways to represent characters and numbers respectively) );
You can use lowercase d and lowercase j to represent the day, and uppercase S represents the suffix of the date.
echo date('Y-m-j');
2007-02-6
echo date('y-n-j');
07-2-6
Uppercase Y represents the four-digit year, while lowercase y represents the two digits of the year digits;
lowercase m represents the number of the month (with leading), while lowercase n represents the number of the month without the leading.
echo date('Y-M-j');
2007-Feb-6
echo date('Y-m-d');
2007-02-06
Capital M represents the 3 abbreviation characters of the month, while lowercase m represents The number of the month (with leading 0);
There is no uppercase J, only lowercase j represents the date of the month, without the leading o; if the month needs to be preceded, use lowercase d.
echo date('Y-M-j');
2007-Feb-6
echo date('Y-F-jS');
2007-February-6th
Capital M represents the 3 abbreviation characters of the month, while capital F represents the month written in full English. (No lowercase f)
Capital S represents the suffix of the date, such as "st", "nd", "rd" and "th", depending on the date number.
2, hours: minutes: seconds
By default, the time displayed by PHP interpretation is "Greenwich Mean Time", which is 8 hours different from our local time.
echo date('g:i:s a');
5:56:57 am
echo date('h:i:s A');
05:56:57 AM
lowercase g represents the 12-hour clock, There is no leading 0, and the lowercase h represents the 12-hour clock with leading 0.
When using the 12-hour clock, you need to indicate morning and afternoon. Lowercase a represents lowercase "am" and "pm", and uppercase A represents uppercase "AM" and "PM".
echo date('G:i:s');
14:02:26
Capital G represents the hour in 24-hour format, but without leading; use capital H to represent the hour in 24-hour format with leading
Summary:
The letter g represents the hour without a leading, the letter h represents the hour with a leading;
The lowercase g and h represent the 12-hour format, and the uppercase G and H represent the 24-hour format.
3, leap year, week, day
echo date('L');
Whether this year is a leap year: 0
echo date('l');
Today is: Tuesday
echo date('D');
Today is: Tue
Capital L means to determine whether this year is a leap year, Boolean value, returns 1 if true, otherwise 0;
Lowercase l means the full English version of the day of the week (Tuesday);
Use capital D to represent the 3 characters of the day of the week Abbreviation (Tue).
echo date('w');
Today's week: 2
echo date('W');
This week is the 06th week of the year
Lowercase w represents the day of the week, in numerical form
Capital W represents the year The number of the week in
echo date('t');
This month has 28 days
echo date('z');
Today is the 36th day of this year
Lowercase t means how many days in the current month
Lowercase z means today It is the day of the year
4, others
echo date('T');
UTC
Capital T indicates the time zone setting of the server
echo date('I');
0
Capital I indicates whether the current time is Daylight saving time, returns 1 if true, otherwise 0
echo date('U');
1170769424
Uppercase U represents the total number of seconds from January 1, 1970 to the present, which is the UNIX timestamp of the Unix time epoch.
echo date('c');
2007-02-06T14:24:43+00:00
lowercase c represents the ISO8601 date, the date format is YYYY-MM-DD, use the letter T to separate the date and time, the time format For HH:MM:SS, the time zone is expressed as an offset from Greenwich Mean Time (GMT).
echo date('r');
Tue, 06 Feb 2007 14:25:52 +0000
lowercase r represents the RFC822 date.
5. Format time
echo $row["t_time"]; will output 2008-2-29 12:08:00
echo date("Y-m-d",strtotime($row["t_time"])); will output 2008-2-29
Note, since the time obtained by $row["t_time"] is already a string, you need to use strtotime (string to timestamp) to convert it, otherwise the error of 1970-01-01 will be output.
The above has introduced the arrangement of parameters related to the date function in PHP, including the content of disk error press any key to re. I hope it will be helpful to friends who are interested in PHP tutorials.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP remains important in modern web development, especially in content management and e-commerce platforms. 1) PHP has a rich ecosystem and strong framework support, such as Laravel and Symfony. 2) Performance optimization can be achieved through OPcache and Nginx. 3) PHP8.0 introduces JIT compiler to improve performance. 4) Cloud-native applications are deployed through Docker and Kubernetes to improve flexibility and scalability.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software