Basic Functions
Date () Get dates, format: 2004-2-28
Time () to get the date, format: 22:24:59
Now () Get date and time format: 2005-5-2 22:37:30
How to use:
D=date ()
Get Year: Years (d)
Get month: month (d)
Get Days: Day (d)
Get Day of the
The Date type in ECMAScript is built on the Java.unile.Date class in early Java. This date type uses the number of milliseconds since UTC (Coordinated Universal time, international coordination times) to start at midnight January 1, 1970 to save
Reading Table of Contents
Object type
1, through the constructor to create2. Creating objects by literal notation
Array type
The same array can also be created in two ways:If we want to print all the values in the array, we can print the
First, the constructor of dateThere are four types of date constructors://1. The constructor does not have parameters, it returns the Date object of the current dayvarnow=NewDate ();//2. The parameter of the constructor is the number of milliseconds
For operations on string positions, the first position is marked as 1.
ASCII (str)
Returns the ASCII code value of the leftmost character of the string str. If Str is an empty string, returns 0. If STR is NULL, returns NULL.
Mysql> Select ASCII (' 2
DayOfWeek (date)
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values correspond to ODBC standards.Mysql> Select DayOfWeek (' 1998-02-03 ');-> 3
Weekday (date)Returns the week index of date (0= Monday, 1 =
For example, to find out from 2007-10-12 to 2007-10-31 on the site registered members, select a good date, click the "Query" button, found that the 2007-10-31 registered members of the information is not shown at all, tested several times the
Here is an example of using a date function. The following query selects all records and its date_col value is within the last 30 days:
Mysql> SELECT something from table
WHERE To_days (now ())-To_days (Date_col)
DayOfWeek (date)
Returns the week
Tag: Style color strong for line timeI. Introduction to Character types
1,
CHAR, VARCHAR, TEXT is called a non-binary string;
2,
binary, VARBINARY, BLOB called binary string
3. Column type Storage
MYSQL gets the current date and date formatGet system Date: Now ()Formatted Date: date_format (date, format)Note: Date: Time fieldFormat: Date formatsReturns the system date, output 2009-12-25 14:38:59Select Now ();Output 09-12-25Select Date_format (
The original: What is the function of MySQL to get the current time of the format date?Get the current time with now () on the line.Format the time in the database with Date_forma T (date, format).Formats a date or date and time value according to
I. Annual ENQUIRY Enquiry data for the yearSELECT * fromblog_articleWHERE Year(From_unixtime (Blogcreatetime))= Year(Curdate ()) Second, query quarterly data query data with quarter numberSELECTArticleID, Quarter (from_unixtime (' Blogcreatetime ')
MySQL formatted date: date_format (date, format)Date: Time fields format: Date formatFormat the date value according to the format string:%s,%s two digits in seconds (00, 01, ..., 59)%I,%I two digits in the form of points (00, 01, ..., 59)%H two
1. Convert a datetime column to a fixed format in a single piece of dataDate_format (create_date, '%y-%m-%d%T ') (Ps:create_date is a column name) results: 2016-10-17 10:37:03Parameter description:%s,%s two digits in seconds (00, 01, ..., 59)%i two
Mysql database Date and Time Functions, mysql function Daquan, summary record, for later use.
DAYOFWEEK (date)The return date is the day of the week (1 = Sunday, 2 = Monday ,...... 7 = Saturday, ODBC Standard)Mysql> select DAYOFWEEK ('2017-02-03 ');-
DATE_FORMA T (date, format) format the date or date and Time Value Based on the format string, and return the result string.You can use DATE_FORMAT () to format the DATE or DATETIME value to obtain the expected format. Format the date value based on
Record an SQL statement first.Select uid, rank, money, e, from_unixtime (time/1000) from stats_2012_01_19 where comm = 8888 and e> 40 and from_unixtime (time/1000) between '2017-01-19 00:00:00 'and '2017-01-19 01:00:00'Then start to convert
Mysql time processing function DAYOFWEEK (date) returns the index of the week of the date (1 = Sunday, 2 = Monday ,... 7 = Saturday ). These index values correspond to the ODBC standard. Mysql> select DAYOFWEEK ('1970-02-03 ');-> 3 WEEKDAY (date)
This article shares an article on mysql date formatting implementation. This article mainly introduces some references for date_format () functions and their usage in cmd mode, in fact, it is the same in cmd and php. If you need it, you can refer to
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.