In PostgreSQL, mod()
is a mathematical function that returns the remainder from division of the first argument (the dividend) by the second argument (the divisor).
Tag: what is
How Width_Bucket() Works in PostgreSQL
In PostgreSQL, width_bucket()
is a mathematical function that assigns values to buckets (individual segments) in an equiwidth histogram.
The return type is int.
Continue readingHow the timezone() Function Works in PostgreSQL
In PostgreSQL, you can use the timezone()
function to convert a timestamp to another timezone.
How to_timestamp() Works in PostgreSQL
According to the PostgreSQL documentation, there are two functions called to_timestamp()
:
- One converts the Unix epoch to a timestamp. The Unix epoch is the number of seconds since 1970-01-01 00:00:00+00.
- The other converts a string to a timestamp.
More specifically, each function converts the value to a timestamp with time zone value.
Although the Postgres documentation presents them as two separate to_timestamp()
functions, I present them as if they’re one function that accepts either one argument, or two.
How to_date() Works in PostgreSQL
In PostgreSQL, you can use the to_date()
function to convert a string to a date.
How current_timestamp() Works in PostgreSQL
In PostgreSQL, the current_timestamp()
function returns the current date and time, including the time zone offset.
The timestamp returned is based on the start time of the current transaction.
Continue readingHow LocalTimeStamp() Works in PostgreSQL
In PostgreSQL, the localtimestamp()
function returns the local date and time, without the time zone offset.
If you need the time zone offset, use current_timestamp()
instead.
How date_part() Works in PostgreSQL
In PostgreSQL, the date_part()
function retrieves subfields such as the year, month, hour, or minute, part from a date/time value.
It’s equivalent to the extract()
function, although with a slightly different syntax.
How Extract() Works in PostgreSQL
In PostgreSQL, the extract()
function retrieves subfields such as the year, month, hour, or minute, part from a date/time value.
It’s equivalent to the date_part()
function, although with a slightly different syntax.
How justify_interval() Works in PostgreSQL
In PostgreSQL, the justify_interval()
function adjusts an interval using justify_days
and justify_hours
. It allows you to use additional sign adjustments to adjust the interval.