By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,874 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,874 IT Pros & Developers. It's quick & easy.

Unix timestamp , unix timestamp with microseconds

P: n/a
I I read the documentation well (PG 7.3.3 ) , i see that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressed as microseconds"

ie there it is impossible to direct insert and select

seconds_from _Epoch
seconds_from _Epoch (period) microseconds_part
seconds_from _Epochmicroseconds_part

without some data conversion ?

Thanx for help
Nov 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In. Martin Prášek wrote:
I I read the documentation well (PG 7.3.3 ) , i see that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressed as microseconds"

ie there it is impossible to direct insert and select

seconds_from _Epoch
seconds_from _Epoch (period) microseconds_part
seconds_from _Epochmicroseconds_part

without some data conversion ?


You could use a numeric type if that's what you want - you'll want to
check the size but something like numeric(12,3) should do the job. Be
aware that numerics are much slower than int's though.

If you want separate access to the seconds/microsecs parts then you'll
need your define your own type - other people have done so, but you'll
need some knowledge of C.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2

P: n/a
Richard Huxton <de*@archonet.com> writes:
In. Martin Prášek wrote:
I I read the documentation well (PG 7.3.3 ) , i see that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressed as microseconds"

ie there it is impossible to direct insert and select

seconds_from _Epoch
seconds_from _Epoch (period) microseconds_part
seconds_from _Epochmicroseconds_part

without some data conversion ?
You could use a numeric type if that's what you want -


I'd stick with the basic float representation of timestamps. We don't
have the particular syntaxes suggested above, but the functionality is
all there, eg

regression=# select extract(epoch from now());
date_part
------------------
1085153447.89091
(1 row)
regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.