Php to compare the date size of two strings
This example describes how to compare the date size of two strings in php. Share it with you for your reference. The details are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2
Original: Conversion of timestamps and date formats in PHPOne, the PHP timestamp function gets the UNIX timestamp of the specified date Strtotime ("2009-1-22″) example is as follows:Echo strtotime ("2009-1-22″) Results: 1232553600Description: Return
There are many kinds of functions in the PHP language, different ways of application, and the functions of implementation are not the same. In this paper, we summarize the PHP timestamp function, hoping to be a reference learning object.
1.PHP Timestamp function converts date to UNIX timestamp
World Doomsday Timestamp PHP
The code is as follows
echo "Doomsday timestamp:". Strtotime ("2012-12-21")
2. Convert timestamps to System time
One, the PHP timestamp function gets the UNIX timestamp of the specified date Strtotime ("2009-1-22″) example is as follows:Echo strtotime ("2009-1-22″) Results: 1232553600Description: Return January 22, 2009 0:0 0 seconds timestampSecond, the PHP
There are many kinds of functions in the PHP language, different application methods, the implementation of the function is not the same. We summarize the PHP timestamp function in this article, hoping to be a reference learning object. Discussion
: This article mainly introduces the php output time difference. if you are interested in the PHP Tutorial, you can refer to it. Use strtotime ("-1 day") for the test ");
The previous day of today, that is, yesterday. Today is determined based on
This article is mainly to share with you PHP timestamp function in detail, mainly in the form of code and we share, hope to help everyone.
echo "Doomsday timestamp:". Strtotime ("2012-12-21")
2. Convert timestamps to System time
Date (' y-m-d h:i:s
There are many kinds of functions in the PHP language, different ways of application, and the functions of implementation are not the same. In this paper, we summarize the PHP timestamp function, hoping to be a reference learning object.
The PHP
One, the PHP timestamp function gets the UNIX timestamp of the specified date Strtotime ("2009-1-22″) example is as follows:Echo strtotime ("2009-1-22″) Results: 1232553600Description: Return January 22, 2009 0:0 0 seconds timestampTwo, php
IntroducedPHP is a very amazing language. It's strong enough (the core language of the biggest blog (WordPress)), it's wide enough (running on Facebook, the biggest social networking site), and it's simple enough (as a beginner's preferred starter
Give a simple date exampleI will use the echo command to output the content to our client (browser). I will use the following code as the base code.
The code is as follows
Copy Code
getting started with dates in php5Date_
Introduced
PHP is a very amazing language. It's strong enough (the core language of the biggest blog (WordPress)), it's wide enough (running on Facebook, the biggest social networking site), and it's simple enough (as a beginner's preferred starter
Copy Code code as follows:
/*
| Author:yang Yu
| @param char|int $start _date A valid date format, such as: 20091016,2009-10-16
| @param char|int $end _date ditto
| @return weekend days between given dates
*/
function
In php, the date function can directly convert the timestamp into a date. Of course, there are some other methods. I won't talk much at the beginning of the article to avoid getting more and more difficult to understand, let's take a look at some
Strftime is a common PHP in the date-time acquisition function, will be stored in the database of the number converted to a function of time, here for you to introduce the use of strftime function and parameters, the need for friends can refer to
1. Determine the day of the week
/**
* Determine the day of the week
* @param $date format ' YYYY-MM-DD ' format error returns false to correctly return a day from Monday to Sunday of the corresponding date
*/
function
Time calculation problem Ah ... List the most recent 6 months before and after
$arr = Array ();
$nowd = Date ("Ym");
$arr [] = Date ("Ym", Strtotime ("-6 month"));
$arr [] = Date ("Ym", Strtotime ("-5 month"));
$arr [] = Date ("Ym", Strtotime ("-4
1. The PHP timestamp function converts a date to a unix timestamp.Doomsday timestamp PHP The code is as follows: Copy code Echo "doomsday timestamp:". strtotime ("2012-12-21 ")
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.