Sort: Rank

How To Calculate the Difference between Two Dates
How To Calculate the Difference between Two Dates? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have two dates, and you want to know how many days between them, you can use the DATEDIFF(date1, date2) function as shown below: SELECT DATEDIFF(DATE('1997-02-28'), DATE('1997-03-01'))...
2007-05-11, 5234👍, 0💬

How To Enter Microseconds in SQL Statements
How To Enter Microseconds in SQL Statements? - MySQL FAQs - Introduction to SQL Date and Time Handling If you want to enter microseconds in a SQL statements, you can enter them right after the time string as a 6-digit number delimited with '.'. '0' will be padded to right if not enough digits. Here ...
2007-05-11, 8588👍, 0💬

How To Present a Past Time in Hours, Minutes and Seconds
How To Present a Past Time in Hours, Minutes and Seconds? - MySQL FAQs - Introduction to SQL Date and Time Handling If you want show an article was posted "n hours n minutes and n seconds ago", you can use the TIMEDIFF(NOW(), pastTime) function as shown in the following tutorial exercise: SELECT TIM...
2007-05-11, 4914👍, 0💬

How To Convert Character Strings to Dates
How To Convert Character Strings to Dates? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a character string that represents a date, and you want to convert it into a date value, you can use the STR_TO_DATE(string, format) function. STR_TO_DATE() shares the same formatting cod...
2007-05-11, 5720👍, 0💬

How To Calculate the Difference between Two Time Values
How To Calculate the Difference between Two Time Values? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have two time values, and you want to know the time difference between them, you can use the TIMEDIFF(time1, time2) function as shown below: SELECT TIMEDIFF(TIME('19:26:50'), TIM...
2007-05-11, 5150👍, 0💬

How To Extract a Unit Value from a Date and Time
How To Extract a Unit Value from a Date and Time? - MySQL FAQs - Introduction to SQL Date and Time Handling If you want to extract a specific date or time unit value out of a date or a time, you can use the EXTRACT(unit FROM expression) function. The tutorial exercise below gives you some good examp...
2007-05-11, 4853👍, 0💬

How To Convert Dates to Character Strings
How To Convert Dates to Character Strings? - MySQL FAQs - Introduction to SQL Date and Time Handling You can convert dates to character strings using the DATE_FORMAT(date, format) function. MySQL supports the following basic formatting codes: %a Abbreviated weekday name (Sun..Sat) %b Abbreviated mon...
2007-05-11, 5452👍, 0💬

How To Write Date and Time Literals
How To Write Date and Time Literals? - MySQL FAQs - Introduction to SQL Date and Time Handling MySQL offers a number of formats for you to use to enter date and time literals: ANSI standard format: "YYYY-MM-DD HH:MM:SS". Non-standard limiters. Like: "YYYY/MM/DD HH^MM^SS" or "YYYY.MM.DD HH-MM-SS". No...
2007-05-11, 5057👍, 0💬

What Are Date and Time Data Types
What Are Date and Time Data Types? - MySQL FAQs - Introduction to SQL Date and Time Handling MySQL supports the following date and time data types: DATE - A date in the range of '1000-01-01' and '9999-12-31'. Default DATE format is "YYYY-MM-DD". DATETIME - A date with the time of day in the range of...
2007-05-11, 4875👍, 0💬

What Are Date and Time Functions
What Are Date and Time Functions? - MySQL FAQs - Introduction to SQL Date and Time Handling MySQL offers a number of functions for date and time values: ADDDATE(date, INTERVAL expr unit) - Adding days to a date. Same as DATE_ADD(). ADDTIME(time1, time2) - Adding two time values together. CURDATE() -...
2007-05-11, 4859👍, 0💬

What Are Date and Time Intervals
What Are Date and Time Intervals? - MySQL FAQs - Introduction to SQL Date and Time Handling A date and time interval is special value to be used to increment or decrement a date or a time at a given date or time unit. A data and time interval should be expression in the format of "INTERVAL expressio...
2007-05-11, 4988👍, 0💬

How To Decrement Dates by 1
How To Decrement Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a date, and you want to decrement it by 1 day, you can use the DATE_SUB(date, INTERVAL 1 DAY) function. You can also use the date interval subtraction operation as "date - INTERVAL 1 DAY". The tutorial...
2007-05-11, 9107👍, 0💬

How To Increment Dates by 1
How To Increment Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a date, and you want to increment it by 1 day, you can use the DATE_ADD(date, INTERVAL 1 DAY) function. You can also use the date interval add operation as "date + INTERVAL 1 DAY". The tutorial exercis...
2007-05-11, 6727👍, 0💬

How Many Ways to Get the Current Time
How Many Ways to Get the Current Time? - MySQL FAQs - Introduction to SQL Date and Time Handling There are 8 ways to get the current time: SELECT NOW() FROM DUAL; 2006-07-01 10:02:41 SELECT CURRENT_TIME() FROM DUAL; 10:02:58 SELECT SYSDATE() FROM DUAL; 2006-07-01 10:03:21 mysql> SELECT CURRENT_TIMES...
2007-05-11, 4982👍, 0💬

What Is TIMESTAMP
What Is TIMESTAMP? - MySQL FAQs - Introduction to SQL Date and Time Handling A TIMESTAMP data type allows you to record a date and time like DATETIME data type. But it has some interesting features when used on a table column: The first TIMESTAMP column in a table will be assigned with the current d...
2007-05-11, 4834👍, 0💬

  Sort: Rank