Database.Guide

Skip to content

Beginners

  • What is a Database?
  • Database Tutorial

SQL

  • SQL Tutorial
  • SQL Reference
  • SQL Joins Tutorial
  • SQL Transactions Tutorial
  • Basic SQL Queries

Categories

  • Azure SQL Edge (17)
  • Database Concepts (99)
  • Database Tools (72)
  • DBMS (9)
  • DuckDB (148)
  • MariaDB (424)
  • Microsoft Access (17)
  • MongoDB (265)
  • MySQL (602)
  • NoSQL (8)
  • Oracle (301)
  • PostgreSQL (480)
  • Redis (210)
  • SQL (697)
  • SQL Server (1,170)
  • SQLite (299)

Tag: date functions

TIME_FORMAT() Examples – MySQL

Posted on July 3, 2018January 28, 2021 by Ian

In MySQL, you can use the TIME_FORMAT() function to format a time value.

This function works just like the DATE_FORMAT() function, except that the value can only be formatted in hours, minutes, seconds, and microseconds.

See the table at the bottom of this article for a list of format specifiers that can be used with this function.

Continue reading →

MySQL date functions, dates, functions

TIMESTAMPDIFF() Examples – MySQL

Posted on July 3, 2018January 28, 2021 by Ian

The MySQL TIMESTAMPDIFF() function is used to find the difference between two date or datetime expressions. You need to pass in the two date/datetime values, as well as the unit to use in determining the difference (e.g., day, month, etc). The TIMESTAMPDIFF() function will then return the difference in the specified unit.

Continue reading →

MySQL date functions, dates, functions

TIMESTAMPADD() Examples – MySQL

Posted on July 2, 2018January 28, 2021 by Ian

In MySQL, the TIMESTAMPADD() function allows you to add a specified amount of time to a date or datetime value. You specify the unit to add, as well as how many of that unit to add. It accepts three arguments, which are used for the initial value, the amount to add, and the unit to use.

Continue reading →

MySQL date functions, dates, functions

TIMESTAMP() Examples – MySQL

Posted on July 2, 2018January 28, 2021 by Ian

In MySQL, the TIMESTAMP() function returns a datetime value based on the argument/s passed in. You can provide one argument or two. If you provide two, it adds the second one to the first and returns the result.

Continue reading →

MySQL date functions, dates, functions

TIMEDIFF() vs SUBTIME() in MySQL: What’s the Difference?

Posted on July 1, 2018January 28, 2021 by Ian

You might have noticed that MySQL has a TIMEDIFF() function and a SUBTIME() function. And you may have noticed that in many cases, they both return the same result. So you may be wondering what the difference is between these two functions?

Let’s find out.

Continue reading →

MySQL date functions, dates, functions

TIMEDIFF() Examples – MySQL

Posted on July 1, 2018January 28, 2021 by Ian

The MySQL TIMEDIFF() function returns the difference between two time or datetime values.

The way it works is, you provide the two values to compare, and TIMEDIFF() subtracts the second value from the first, then returns the result as a time value.

Continue reading →

MySQL date functions, dates, functions

TIME() Examples – MySQL

Posted on July 1, 2018January 28, 2021 by Ian

When working with MySQL, you can use the TIME() function to extract the time part from a time or datetime value.

The way it works is, you pass the time/datetime expression in as an argument, and TIME() will return the time part.

Continue reading →

MySQL date functions, dates, functions

SUBTIME() Examples – MySQL

Posted on July 1, 2018January 28, 2021 by Ian

In MySQL, you can use the SUBTIME() function to subtract a time value from a time or datetime expression.

The way it works is, you provide two arguments; the first is a time or datetime value, and the second is a time value. The SUBTIME() function then subtracts the second argument from the first one and returns the result.

Continue reading →

MySQL date functions, dates, functions

STR_TO_DATE() Examples – MySQL

Posted on June 30, 2018September 5, 2021 by Ian

The MySQL STR_TO_DATE() function allows you to build a date value from the various date parts.

When using this function, you provide a string of the various date parts, and a second argument that specifies the format that the date is provided in.

Continue reading →

MySQL conversion functions, date functions, dates, functions

SEC_TO_TIME() Examples – MySQL

Posted on June 30, 2018September 5, 2021 by Ian

When using MySQL, you can use the SEC_TO_TIME() function to build a time value based on a given number of seconds. Basically, you provide the number of seconds as an argument, and it will convert that to a time value.

Here’s how it works.

Continue reading →

MySQL conversion functions, date functions, dates, functions
  • «
  • 1
  • …
  • 19
  • 20
  • 21
  • 22
  • 23
  • …
  • 31
  • »

About Database.Guide | Privacy Policy