Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 961319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:19:29+00:00 2026-05-16T01:19:29+00:00

I want to get data from Postgres. There is a column in type timestamp

  • 0

I want to get data from Postgres. There is a column in type timestamp without timezone. Simple SELECT returns me formatted date but I want timestamp in miliseconds simply. How I can do it in SQL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:19:30+00:00Added an answer on May 16, 2026 at 1:19 am
    select extract(epoch from my_timestamp)
    

    This returns time in seconds. However, it is a decimal number with fractions of the second after the decimal point. Read more about precision below.

    For millis, use:

    select extract(epoch from my_timestamp)*1000
    

    Test:

    select my_date, 
    extract(epoch from my_date)*interval'1s'+'epoch'::timestamp at time zone 'GMT'
    

    Note on precision

    extract returns a “double precision” number, which fits 15 digits in Postgres. It means that around 2016 (as I write this), the actual precision is 10 microseconds. Note how it rounds off the last digit:

    select extract('epoch' from '2016-09-20T11:22:33.456789Z'::timestamp);
        date_part     
    ------------------
     1474370553.45679
    (1 row)
    

    For dates like 270 years in the future, this data type will only be able to represent 100-microsecond precision. Seems like a decent precision from the perspective of 2016, and I guess things might change a bit before we reach that year.

    select extract('epoch' from '2290-09-20T11:22:33.456789Z'::timestamp);
        date_part     
    ------------------
     10120936953.4568
    (1 row)
    

    Either way, it will continue to work just fine for millisecond precision for a while.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to get data from mysql db, first user select db, then enters
Hi there i want to get data from the below combo box in cakephp
I want to get data from mysql database with the help of DataImportHandler so
I want to get data from table in MySQL and to show it in
I want to get data from two tables. I have patient first name and
I want to get data from a table in my MySQL database. $linkID =
I want to get data from two tables with single Entity class. How?? public
Whenever I want to get data from a plist file I use the following
Here's the scenario, I want to get Data from the Service to Activity Whenever
i am new to asp.net, ı want to get data from url on asp.net.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.