to_float()

Scalar. Converts a given value to a float.

Syntax

to_float ( value )

Parameters

value

A string, interval, date/time type, numeric type, or money type.

Usage

Converts a given value to a float. The function takes a string, interval, date/time type, numeric type, or money type as its argument, and the function returns a float . Note that the function can also take a float as its argument, but it will return the same float value.

A string converts based on the format for a float literal. An interval returns a value representing a number of microseconds. A date/time type returns a value representing the number of seconds, milliseconds, or microseconds from the epoch (midnight, January 1, 1970 UTC) depending on whether the input type is a date, timestamp or bigdatetime respectively. Those date/time types prior to the epoch convert to a negative value.

Example

to_float ('100.0')returns 100.0.