Programmers who write Php+mysql know there is a time difference, UNIX timestamp and format date are two time representations we often deal with, Unix timestamp storage, processing convenient, but not intuitive, format date intuitive, but not as easy
PHP gets today, yesterday, last week, this month's start time stamp and end time stamp method, mainly uses in the PHP time function mktime. Let's start with an example of how to use Mktime to get the start time stamp and end time stamp for today,
Date_default_timezone_get (): Gets the current time zone of PHP date_default_timezone_set (): Sets the current time zone for PHPDate ("Y-m-d h-i-s")time (): Returns the current timestamp (1970-1-1--to date) unit seconds
strtotime (): Converts the
PHP gets constellation information and zodiac information based on date or time stamp, PHP constellation
Share a function method that uses PHP to obtain the corresponding Ganzhi, Zodiac, and constellation information based on date or time stamp,
Copy Code code as follows:
PHP gets today start timestamp and end time stamp
$beginToday =mktime (0,0,0,date (' m '), date (' d '), date (' Y '));
$endToday =mktime (0,0,0,date (' m '), date (' d ') +1,date (' Y '))-1;
PHP gets
Use the function date () to implement the displayed in the format: year-month-day hours: minutes: secRelated Time parameters:A-"AM" or "PM"A-"AM" or "PM"D-A few days, two digits, if less than two digits before the 0; such as: "01" to "31"D-Days of
When I used to solve this problem with ASP is quite simple, the ASP has the corresponding function DateDiff can give two days period interval How many months, how many days and how many seconds. When I searched through the PHP manual I found that
PHP time stamp and day conversion and calculation examples, Phpunix
Unix timestamps are a compact and concise way to save dates and times, a way to save the current date and time in most Unix systems, and a standard format for representing dates
PHP implementation of the method based on timestamps to get weeks, PHP stamp gets weeks
The examples in this article describe how PHP implements the week-by-time timestamp. Share to everyone for your reference, as follows:
Gets the number of weeks
Requirements:Converts the time of the int type displayed on the first page to the time format of the date type:when Questionmodel gets to question list data, including question[' Pub_time '), it needs to be converted to a specific time format for
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.