Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle - Fetch date/time in milliseconds from DATE datatype field

I have last_update_date column defined as DATE field

I want to get time in milliseconds.

Currently I have:

TO_CHAR(last_update_date,'YYYY-DD-MM hh:mi:ss am')

But I want to get milliseconds as well.

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.

like image 498
drake Avatar asked Dec 10 '22 17:12

drake


1 Answers

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.

Here is a link to another SO question regarding Oracle date and time precision.

like image 127
RC. Avatar answered Jun 01 '23 08:06

RC.