In MariaDB, TO_SECONDS()
is a built-in date and time function that returns the number of seconds from year 0 to the given date or datetime expression.
Tag: conversion functions
How TIME_TO_SEC() Works in MariaDB
In MariaDB, TIME_TO_SEC()
is a built-in date and time function that returns its time argument, converted to seconds.
How STR_TO_DATE() Works in MariaDB
In MariaDB, STR_TO_DATE()
is a built-in date and time function that returns a datetime value, based on the given date string and format string.
The STR_TO_DATE()
function is the inverse of the DATE_FORMAT()
function.
How SEC_TO_TIME() Works in MariaDB
In MariaDB, SEC_TO_TIME()
is a built-in date and time function that returns a time value, based on the number of seconds provided as arguments.
How TO_DAYS() Works in MariaDB
In MariaDB, TO_DAYS()
is a built-in date and time function that returns the number of days from the start of the standard calendar (0000-00-00), based on a given date.
You pass the date to the function when you call it.
The TO_DAYS()
function is the converse of the FROM_DAYS()
function.
MariaDB to Introduce TO_CHAR()
The TO_CHAR()
function has beeen introduced in MariaDB 10.6.1.
How TO_BASE64() Works in MariaDB
In MariaDB, TO_BASE64()
is a built-in string function that converts its string argument to its base-64 encoded form.
The TO_BASE64()
function returns its result as a character string in the connection character set and collation (see how to get your connection’s collation).
How CONVERT() Works in MariaDB
In MariaDB, CONVERT()
is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.
You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.
CONVERT()
is similar to CAST()
.
How CAST() Works in MariaDB
In MariaDB, CAST()
is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.
You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.
CAST()
works similar to CONVERT()
.
How the to_number() Function Works in PostgreSQL
In PostgreSQL, you can use the to_number()
function to convert a string to a numeric value.
More specifically, it converts the string representation of a number to a numeric value.
For example, if you have $1,234.50
as a string, you can use to_number()
to convert that to an actual number that uses the numeric data type.