1

I want to convert type date unix to timestamp in Informix. My column date1 contains values as 1598915961, 1598911249, 1598911255...

expected output: 2020-02-13 15:00:00

How should I do it, please?

Jappa
  • 101
  • 8

2 Answers2

2

In Informix, you can use dbinfo() and 'utc_to_datetime':

select dbinfo('utc_to_datetime', myepoch)
GMB
  • 216,147
  • 25
  • 84
  • 135
0

The idea is that you can add the seconds to the date '1970-01-01'. I don't have Informix on-hand, but the syntax is something like this:

select datetime('1970-01-01') + interval date1 second
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • The general idea is correct but Informix throws a number of spanners into the works. The most significant is that it limits the number of seconds that can be added in a single operation to 999,999,999. See [Informix FROM_UNIXTIME alternative](https://stackoverflow.com/q/55600549/15168). – Jonathan Leffler Sep 04 '20 at 13:43