0

I have a table with the following fields:

my_date     my_time     my_time2
2017-04-14  10:00:01    286115

How do I combine these fields into timestamp column like 2017-04-14 10:00:01.286115? Unfortunately select my_date+my_time+my_time2 from my_table works fine only for the first two fields. Thanks in advance.

2
  • 1
    What are the data types? Commented Apr 15, 2017 at 10:44
  • date,time,int4 respectively. Commented Apr 15, 2017 at 12:01

1 Answer 1

1
select date '2017-04-14' + time '10:00:01' + 286115 * interval '1usec';
┌────────────────────────────┐
│          ?column?          │
╞════════════════════════════╡
│ 2017-04-14 10:00:01.286115 │
└────────────────────────────┘
(1 row)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.