简体   繁体   中英

How to use date_trunc in PostgreSQL to truncate to100 milliseconds?

The date_trunc function uses field either millisecond or second, but millisecond is too small for me and second too large. I want something in between like 100 milliseconds (1/10 second).

How can I achieve this in PostgreSQL?

I think you can do this with conversion. The following should give you tenths of a second:

select cast(datecol as timestamp(1))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM