Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

_time() and _date_gmt()

11 views
Skip to first unread message

Roy Hann

unread,
Feb 2, 2015, 5:42:44 AM2/2/15
to
I've lately been dealing with Unix times (i.e. seconds since 00:00
01-jan-1970).

I've done what I needed to do but no thanks to date_gmt() and the
bizarre format it returns, and especially no thanks to _time(). Who
decided a time to one minute precision was good enough?

Ugh.

Roy

Ingres Forums

unread,
Feb 2, 2015, 6:24:43 AM2/2/15
to

How about using the "interval" function for getting the seconds since
01-jan-1970, e.g.:
select int4(interval('sec', date('now')-'01-jan-1970 00:00:00 GMT'))
For getting the date from a given number of seconds since 01-jan-1970
you could use the "gmt_timestamp" function, e.g.:
select gmt_timestamp(1422875366)
returns 2015_02_02 11:09:26 GMT


--
Bodo
------------------------------------------------------------------------
Bodo's Profile: http://community.actian.com/forum/member.php?userid=16
View this thread: http://community.actian.com/forum/showthread.php?t=16597

0 new messages