dwmcc
dwmcc

Reputation: 1074

Trailing Numbers after Timestamp

I'm curious what the trailing numbers after a timestamp represent. In some of my records, timestamps appear as I'm used to seeing them, as so:

2012-04-27 11:12:00

However, in other areas, timestamps appear like this:

2013-06-18 15:20:21.109533

Unfortunately, this breaks the search by date functionality I've built in to the application. Can anyone explain what the significance of the trailing numbers and period (shown below) are, and how to deal with them when I am searching by dates using the initial timestamp format? The records with the trailing numbers simply aren't included in the search, and I would like to normalize them, or search both types.

Interestingly enough, new records that are created have the trailing numbers as well. This leads me to believe that it may be a version upgrade along the way when these numbers started?

Something else that makes the version upgrade explanation compelling is that in several records, the created_at timestamp is in the first format listed, and the updated_at timestamp is in the second.

.109533

Upvotes: 0

Views: 201

Answers (1)

user80168
user80168

Reputation:

These are simply fractional seconds. If you don't want them (can't see why you wouldn't want them, but still) - just change your datatype to timestamp(0). and better yet: timestamptz(0).

Upvotes: 1

Related Questions