necessary to convert each other, the following gives the conversion of several different ways. One, complete in MySQL This way in the MySQL query statement conversion, the advantage is not to occupy PHP parser parsing time, fast, the disadvantage is only used in database query, there are limitations. 1. UNIX timestamp converted to date function: From_unixtime () General form: Select From_unixtime (1156219870); 2.
Recently, when making LUA scripts, we used Lua's date and time functions to find them powerful and learn. In Lua, the function time and
Data provides all the functions of the date and time, and the following two functions are learned separately.
Time function: If you call
Text Functions are functions that can process text strings in formulas. For example, you can change the case sensitivity or determine the length of a text string; you can replace or remove some characters. The date and time functions can analyze and process the date and time
,date ("Y"));echo "Tomorrow is". Date ("y/m/d", $tomorrow);?>
The output of the above code is similar to this:Tomorrow is 2006/07/12.There are some more advanced date-time functions introduced to everyoneThis class will introduce more functions to enrich our appli
this:Tomorrow is 2006/07/12.There are some more advanced date-time functions introduced to everyoneThis class will introduce more functions to enrich our application.
The code is as follows
Copy Code
Checkdate ($month, $date, $year)
If the applied value constitutes a vali
MySQL timestampdiff () functions are much more powerful than datediff () functions. datediff () can only calculate the number of days for the difference between two dates.
Mysql common date addition and subtraction functions and instance tutorialMySQL date typeMySQL
Summary of Access date and time functions. For more information, see
Summary of Access date and time functions. For more information, see
When developing a system today, we need to implement such a function.
Query related content based on the selected date, but not filte
All functions in PHP are in the Unix era, starting January 1, 1970. The date is the number of seconds to start at this time. When a function call is counted as a number of seconds from this time, it is treated as a (timestamp) timestamp.
local time function
1. String date (string Format,inieger timestamp)
The function returns a string representing the time, which
-sun select Next_day ( sysdate , ' 2 ' from Span style= "font-size:16px;font-family: ' Microsoft Jas Black ', ' sans-serif '; color: #000080; background: #FFFFFF;" > DUAL; -- Note: If you use the Monday method parameter, you need to first modify the date language formatALTER SESSION SET nls_date_language= ' AMERICAN ' ; select Next_day ( sysdate , ' MONDAY ' from DUAL; -- Chinese language format, you can also use the method of
In the absence of an IDE, it is necessary to remember the function names, parameters, basic usage, and considerations of some commonly used library functions.Referring to the Linux_c_hs.chm directory, I have roughly divided the usual functions into several categories:
1. Memory and string control and operation
2. String conversions
3. Character test
4. File operation
5. Time and date
The date function is shown in the following table.DescriptionThe datename and DATEPART functions return the integer value of the string that corresponds to the specified date element in the date, respectively.
Function
Parameters
Function
GETDATE
()
Returns the current
MySQL: Summary of date functions and time functions bitsCN.com
Published inWww.sqlstudy.com1. MySQL obtains the current date and time function
1.1 obtain the current date + time (date + time) function: now ()
mysql> select now();
")
Please search for more detailed usage.
Date interval function-datediff (interval, date1, date2[, firstdayofweek][, FirstWeekOfYear])
Calculates the gap between two dates.
For example, you can use DateDiff to calculate the number of days between two dates, or to calculate how many weeks from today to the end of the year. If the date1 is later than Date2, a negative number is returned.
Parameter description:
interval-with DATEADD () function
D
1.1 obtain the current date + time (date + time) function: now ()
Mysql> select now ();
+ --------------------- +| Now () |+ --------------------- +| 22:20:46 |+ --------------------- +In addition to the now () function, MySQL also has the following functions:
Current_timestamp (), Current_timestamp, Localtime (), Localtime, Localtimestamp -- (v4.0.6), Localtime
JS obtains time-related functions and converts timestamp to time and date. js obtains
Timestamp and date conversion are common operations. The following describes how to implement mutual conversion through code examples.
Before learning this article, I will introduce the Date () constructor parameters in javascript:
Yo
MYsql Date and Time Functions
MYsql Date and Time Functions
For the description of the valid format of the value range of each type and the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using
1. MySQL obtains the current date and time function1.1 obtain the current date + time (date + time) function: now ()Mysql> select now ();
+ --------------------- +| Now () |+ --------------------- +| 22:20:46 |+ --------------------- +
In addition to the now () function, MySQL also has the following functions:Current_timestamp (), Current_timestamp, Localtime (),
Original link:MySQL time and date function-Redfox-Blog ParkHttp://www.cnblogs.com/redfox241/archive/2009/07/23/1529092.html--------------------------------------------------------------------------------------------------------------- ---------------------------------------First, MySQL gets the current date time function1.1 Get the current date + time (
Here is an example of using the date function. The following query Selects all records, and its date_col is within the last 30 days: mysqlSELECTsomethingFROMtableWHERETO_DAYS (NOW ())
Here is an example of using the date function. The following query Selects all records, and its date_col is within the last 30 days: mysql SELECT something FROM table WHERE TO_DAYS (NOW ()-TO_DAYS (date_col) = 30; DAYOF MYsql
-02-03 '); 1998 HOUR (Time) Returns the hour of time with a range of 0 to 23. Mysql> Select HOUR (' 10:05:03 '); 10 MINUTE (Time) Returns the minute of time, ranging from 0 to 59. Mysql> Select MINUTE (' 98-02-03 10:05:03 '); 5 SECOND (Time) The number of seconds to return time, ranging from 0 to 59. Mysql> Select SECOND (' 10:05:03 '); 3 Period_add (P,n) Add n months to the stage p (in format Yymm or yyyymm). Returns a value in the format yyyymm. Note that the stage parameter p is not a
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.