Exercise caution when using php's strtotime () function, phpstrtotime Function
In our daily business, we often use time-based horizontal table sharding for the business volume. Queries after table sharding often involve time issues. For example, we
We in the daily business, for the volume of business, often using the database by time to do horizontal sub-table, the query after the table will often involve time issues. For example, we would like to query a user's order for 1 months from the
This example describes how PHP uses the date and Strtotime functions to output the specified dates. Share to everyone for your reference. The specific methods are analyzed as follows:
The date and Strtotime functions in PHP are all for dates, but
PHP Gets the date of last month, next month, month (Strtotime (), date ()), strtotimedate
Write the program today, suddenly found a long time to write a long time to get the number of days of the function, the classic switch version, but to get the
This function uses the TZ environment variable (if any) to calculate the timestamp. PHP 5.1.0 has an easier way to determine the time zone of All/dateTime functions used. This process is explained on the page of the date_default_timezone_get ()
Time (), date (), mktime (), strtotime () in php (). In php, time (), date (), mktime (), strtotime () time (): returns the current Unix timestamp; date (): Formats a local timestamp; mktime (hour, minute, second, month, day, year): get the time (),
Php Tutorial strtotime () calculate the number of days between today and the specified date$ Date1 = strtotime ('2017-04-30 '); // converts a date to a timestamp.$ Date2 = time (); // Obtain the timestamp of the current time$ Nowtime = strftime ("%
Write the program today, suddenly found a long time to write a long time to get the number of days of the function, the classic switch version, but to get the number of days last month, I just put the month-1, it was too sleepy, then saw a kind of
PHP obtains the date (strtotime, date) of the previous month, next month, and this month ). When I was writing a program today, I suddenly found a function that was written a long time ago to get the number of days of the month. The classic switch
PHP is very useful strtotime method
In PHP, the date is often calculated, such as to calculate the date one months ago, then the fastest way
is used Strtotime, its function is very rich, as follows:
Echo Strtotime ("Now"), "\ n", Echo strtotime (
Because the work needs to get the date of the previous month, next month, and this month, we found the implementation code from the website and shared it to help our friends write programs today, I suddenly found the function to get the number of
When I was writing a program today, I suddenly found a function that was written a long time ago to get the number of days of the month. The classic switch version, but when I got the number of days of the previous month, I only set the month to 1,
Because the work needs to get the date of the previous month, next month, and this month, we found the implementation code from the website and shared it to help our friends write programs today, I suddenly found the function to get the number of
In php, strtotime returns the Monday of the given time. In a simple php strtotime, return the Monday implementation code of the time. if you need it, refer to it. The strtotime () function resolves the date and time description of any English text
Today, when I write the program, suddenly found a long time ago to get the number of days of the function, the classic switch version, but to get the number of days last month, I just put the month-1, I guess it was too sleepy, and then see a kind
: This article mainly introduces the powerful time conversion function strtotime of php. if you are interested in the PHP Tutorial, please refer to it. You can use strtotime to convert Time strings of various formats into timestamps.
Convert
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.