How timeofday() Works in PostgreSQL

In PostgreSQL, timeofday() is a non-SQL-standard time function that returns the current date and time, with the time zone abbreviation.

It’s similar to the clock_timestamp() function, except that it returns its result as a formatted text string rather than a timestamp with time zone value. 

The result of both functions changes throughout the execution of a statement. Therefore, you could get a different result in different parts of the statement if you call the functions multiple times within a single statement.

Continue reading

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.

Continue reading