473,385 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unix timestamp , unix timestamp with microseconds

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
2 6890
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Casey | last post by:
Hi! I found several resources describing how to convert the UNIX timestamp to a readable date, however I need to convert a date into a UNIX timestamp. For instance, I'm writing a program that will...
1
by: George Develekos | last post by:
I need to import into mysql data from DB2. One of the DB2 table columns is of the TIMESTAMP type, which, unlike its MySQL counterpart, supports fractions of a second, up to 6 digits, i.e. it is of...
5
by: Andreas | last post by:
Hi, is there any possibility to get a Timestamp in Java from the DB2-System? (not from a table) Thanks for help. Andreas
7
by: kaming | last post by:
Dear all, I found that I can't update or delete a DB2 record with timestamp using Access through ODBC. The Access complains "No current record" while I attempt to update or delete the record...
0
by: NTPT | last post by:
I read the documentation well (PG 7.3.3 ) , it seems that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressedas microseconds" ie there it is impossible...
2
by: Luis P. Mendes | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I've inserted a couple hundred rows in a table in Postgres via psycopg2. The first field of each row is a certain unix time (since epoch)...
6
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
5
by: Jeff Shantz | last post by:
Hello, I am working with DB2 v9, and I am looking to create a TIMESTAMP column in one of my tables that will automatically insert the current date/time when I add a new row. Is there a way to...
1
by: stefan.albert | last post by:
Hi folks, when subtracting 2 timestamps from each other the result is duration. () But in DB2 the format is a bit funny: lets say we have 59,5 seconds. If we have one second more, the result is:...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.