Date and Time functionsThis chapter discusses some functions that can be used to manipulate time values. See section 11.3, "Date and Time type" for valid formats for each time and date type with a range and a specified value.
The following example
Oracle and Mysql time formatting 1. Oracle formatting time: Oracle obtains the current date and Date Format
Get system date: SYSDATE () format Date: TO_CHAR (SYSDATE (), 'yy/MM/DD HH24: MI: SS) or TO_DATE (SYSDATE (), 'yy/MM/DD HH24: MI: SS) format
First, MySQL gets the current date time function1.1 Get the current date + time (date + times) function: Now ()Mysql> Select Now ();+---------------------+| Now () |+---------------------+| 2008-08-08 22:20:46 |+---------------------+In addition to
Linux/unix-time timestamp processing conversion functionThe time function under LinuxWe can often use time in programming, such as getting the system time (to get the system's year, month, day, hour, minute, second, week, etc.), or to do something
Blog. csdn. netkangbrotherarticledetails7030304MYSQL obtains the current date and date format. system date: NOW () formatted date: DATE_FORMAT (date, format) Note: date: Time Field format: returns the system date, output 2009-12-2514: 38: 59
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 ('
The following query selects the records for all date_col values within the last 30 days.
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
Here is an example of using the date function. The following query Selects all records whose date_col values are within the last 30 days.
Here is an example of using the date function. The following query Selects all records whose date_col values
Detailed description of mysql to obtain the current date and format, detailed description of mysql current date
MySQL obtains the current date and Date Format
Get system date: NOW ()
Format date: DATE_FORMAT (date, format)
Note: date: Time
The following query Selects all records whose date_col values are within the last 30 days.
Mysql> SELECT something FROM tbl_nameWHERE TO_DAYS (NOW ()-TO_DAYS (date_col) DAYOFWEEK (date)Returns the week index of date (1 = Sunday, 2 = Monday,... 7 =
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.