Fully collected Mysql date and mysql Time FunctionsDATE_FORMAT (date, format)Format the date value based on the format string. The following modifier can be used in the format string: % M month name (January ...... December)% W name of the Week
All the time in the project was shown as 2014-10-20 10:22 and it looked stiff. In the microblogging, QQ space and other sites are usually displayed for a few seconds ago, a few minutes ago, a few hours ago, such as easy to read time, we call it a
Grammar
Date (format,timestamp) parameter description
Format required. Specifies the format of the timestamp.
Timestamp is optional. Time stamp is specified. The default is the current date and time
To find out the day before is time () -60*60*24;
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
Many times I want to customize some things or actions during vs compilation,
For example:
Copy the generated file to a specific directory.
DeploymentProgramTo the test directory or environment, such as registering with the Windows Service and
The date () function is one of the dates that we often encounter and use in PHP development, and let me introduce some basic dress and method of the date () function, with friends who need to know to enter the reference.
Date-time functions are a
Here are some of the time functions in PHP:
(1) Date
Usage:
Date (format, 1141064899);
If there is no time parameter, the current time is used. The format is a string in which the following characters have special meanings:
You replace 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
Asctime (represents the time and date in string format)
Related functions
Time, ctime, gmtime, localtime
Header file
# Include
Define functions
Char * asctime (const struct TM * timeptr );
Function
1. Time () gets the current time
Time_t timer;
Time (& timer );
Equivalent to timer = Time (null); or timer = time (0 );
It can be used to generate random numbers.
Srand (unsigned) time (0 ));
2. localtime () converts a timestamp into the format of
The following query selects all records and its date_col value is within the last 30 days:
MySQL Tutorials > select something from tablewhere To_days (now ())-To_days (Date_col)
DayOfWeek (date)Returns the week index of date (1= Sunday, 2 =
Dayname returns a mixed case string, with a week representing the name of the day (for example, Friday) for the day portion of the parameter.
DayOfWeek returns the number of days of the week in the argument, expressed as an integer value of 1-7, of
Date.prototype.isLeapYear Judge Leap Year
Date.prototype.Format Date format
DATE.PROTOTYPE.DATEADD Date Calculation
Date.prototype.DateDiff Comparison Date Difference
Date.prototype.toString Date-turn string
Date.prototype.toArray date split into
MySQL Date Type: Date format, occupied storage space, date range comparison.Date type storage space Date format date range------------ --------- --------------------- -----------------------------------------DateTime 8 bytes Yyyy-mm-dd HH:MM:SS 10
If you need to know when your code executes during Web debugging, you can use the Console.time () statement and the Console.timeend () statement to time the execution of your program in JavaScript code. Take this longer-consuming Foo () function for
This is a feature that needs to be implemented today when developing systems
According to the selected date, the query related content, but not according to the whole date to filter, but based on, year, month, Day split form to filter, such as 201
Date and time functions handle various processes that support date and time value conversions. Seven days a week is represented by the following code value.
It's worth seven days a week.
1 Sunday
2 Monday
3 Tuesday
4 Wednesday
5 week Four
6 Friday
7
Mysql> SELECT something from Tbl_name
WHERE To_days (now ()) –to_days (date_col)
DayOfWeek (date)
Returns the week index of date (1 = Sunday, 2 = Monday, ...). 7 = Saturday). Index values are compliant with ODBC standards.
mysql> SELECT DayOfWeek ('
For a description of the range of values owned by each type and the valid format for the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using a date function. The following query selects all records and its
1, year-month-day
echo Date (' y-m-j ');
2007-02-6
echo Date (' y-n-j ');
07-2-6
Capital Y represents a four-digit year, while lowercase y represents a two-digit number for the year;
Lowercase m represents the number of months (with leading),
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.