Oracle-从DATE数据类型字段中获取日期/时间(以毫秒为单位) [英] Oracle - Fetch date/time in milliseconds from DATE datatype field
问题描述
我将last_update_date
列定义为DATE
字段
我想获取时间(以毫秒为单位).
I want to get time in milliseconds.
目前,我有:
TO_CHAR(last_update_date,'YYYY-DD-MM hh:mi:ss am')
但是我也想获得毫秒数.
But I want to get milliseconds as well.
我在Google上搜索了一下,认为DATE
字段将没有毫秒.只有TIMESTAMP
字段会.
I googled a bit and think DATE
fields will not have milliseconds. only TIMESTAMP
fields will.
有没有办法获得毫秒?我没有选择更改字段数据类型的选项.
Is there any way to get milliseconds? I do not have option to change data type for the field.
推荐答案
DATE字段仅将数据存储到一秒,因此没有其他方法可以提供更精确的信息.如果需要更高的精度,则必须使用其他类型,例如TIMESTAMP.
DATE fields on Oracle only store the data down to a second so there is no way to provide anything more precise than that. If you want more precision, you must use another type such as TIMESTAMP.
此处是另一个有关Oracle日期和时间精度的SO问题的链接.
Here is a link to another SO question regarding Oracle date and time precision.
这篇关于Oracle-从DATE数据类型字段中获取日期/时间(以毫秒为单位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!