Formatted dateThe first parameter of the date () function specifies how the date/time is formatted. It uses letters to represent the format of dates and times. Here is a list of some availableThe letters:D-Day of the month (01-31)• M-Current month,
PHP has many built-in functions, most of which are widely used by programmers. But there are some functions hidden in the corner, this article will introduce you to 7 little-known, but very useful functions. A programmer who doesn't use it may wish
1. highlight_string () functions become very useful when PHP code needs to be displayed on a website. This function outputs or returns the syntax highlighted version of the given PHP code by highlighting the color defined in the PHP syntax program.
Here we verify that the date format is yyyy-mm-dd, so that when there is a fixed format of our regular expression, we can write it like this/^ (\ d {4 }) -(\ d {2})-(\ d {2}) $/to operate. I will introduce it below.
Example 1
The Code is
1, get local timestamp
The PHP application Mktime () function converts a time to a Unix timestamp value. Timestamp is a long integer, including from the Unix era (January 1, 1070), a lot of time is based on this as the starting point, interested
This article recommends seven less frequently used php built-in functions, which are very practical and powerful, and save a lot of time. PHP has many built-in functions, most of which are widely used by programmers. But there are also some
This article introduces the specific usage of date and time functions in PHP, with the reference of interested friends.
This paper mainly introduces the use of date, GETDATE, Mktime, checkdate and other dates and time functions. (1) Date
Php regular expression verification date and time format instance code. Using php to verify the date format, we can use the checkdate () function and regular expression to verify the format. next I will introduce some of my processes in verifying
7 little-known but very useful PHP functions
This article mainly introduces 7 little-known but very useful PHP functions, this article summarizes such as highlight_string (), Str_word_count (), Levenshtein (), Get_defined_vars (), Escapeshellcmd ()
7 little-known but very useful PHP functions, little known PHP
Overview
PHP has a number of built-in functions, most of which are used by developers. But there are some equally useful but forgotten in the corner, this article will introduce 7
PHP Date Function Base,datebase
The meaning of letters can be used in the/************** format **************/
A – "AM" or "PM" A – "AM" or "PM" D – a few days, two digits, if less than two digits before 0; such as: "01" to "to" D – days, three
Format dateThe first parameter of the date () function specifies how to format the date/time. It uses letters to indicate the date and time formats. Some availableLetter:• Day in d-month (01-31)• M-current month, in numbers (01-12)• Y-current year
Good JS verification ~~~~~~~~~~~~~~~~~~~~~~~~~Purpose: Verify the IP address format.Input: strIP: IP AddressReturn: If the verification succeeds, true is returned; otherwise, false is returned;*/Function isIP (strIP ){If (isNull (strIP) return false;
Date () is a commonly used date-time function, let me summarize the date () function of the various forms of usage, there is a need to learn the friend can refer to.Formatted dateThe first parameter of the date () function specifies how the
Checkdate: Verify that the date is correct.
Date: format the server time.
Strftime: format the server time locally.
Getdate: Get the time and date information.
Gettimeofday: Get the current time.
Gmdate: Get the current time difference from
Seven little-known but very practical PHP functions, little-known php
Overview
PHP has many built-in functions, most of which are widely used by developers. However, there are also some functions that are useful but forgotten in the corner. This
Good JS verification ~~~~~~~~~~~~~~~~~~~~~~~~~
Purpose: Verify the IP address format.
Input: strIP: IP Address
Return: If the verification succeeds, true is returned; otherwise, false is returned;
*/Function isIP (strIP ){If (isNull (strIP) return
The code is as follows:Copy code /** Author: I don't know who the author is.* Date: 2008-4-13* Function: calculate the time difference between two dates.* Note: the program code is basically not modified. Only the writing specification is defined,
$ Days = date ("y-m-d ");// Method 1 positive verification date The code is as follows:Copy code $ Reg = "/d {4}-d {2}-d {2 }/";Preg_match ($ reg, $ days, $ arr );Print_r ($ arr ); // Method 2 use cehckdate for verification The code is as
7 little-known but super-useful PHP functions, little known PHP
PHP has many built-in functions, most of which are widely used by programmers. But there are some functions hidden in the corner, this article will introduce you to 7 little-known, but
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.