How could I convert from Unix to "timestamp" until minutes?
For example, 1672718268 -> 2023-01-03 06:57
upd.: Format – not string
I tried to use function:
- to_timestamp(timemodified)::date + date_trunc(‘hour’, timemodified) + date_part(‘minute’, timemodified)::int
- to_timestamp(to_timestamp(timemodified)::timestamp,’YYYY-MM-DD HH24:MI’)
- extract(epoch from timemodified) from table
- date_trunc(‘minute’, to_timestamp(timemodified)::timestamp)
2
Answers
This should work:
The result will be a string, not a timestamp because a timestamp also has seconds.
For just the date, cast your timestamp to a date: