Igor Drincic
Igor Drincic

Reputation: 1985

How is Oracle date implemented?

How is Oracle date implemented? Is it stored as milliseconds or something like that?

Upvotes: 18

Views: 18701

Answers (3)

Justin Cave
Justin Cave

Reputation: 231851

An Oracle DATE stores the date and time to the second. An Oracle TIMESTAMP stores the date and time to up to 9 digits of subsecond precision, depending on the available hardware.

Both are implemented by storing the various components of the date and the time in a packed binary format. From the Oracle Concepts Guide section on dates

Oracle uses its own internal format to store dates. Date data is stored in fixed-length fields of seven bytes each, corresponding to century, year, month, day, hour, minute, and second.

You can use the DUMP() function to see the internal representation of any particular date (or any other value for that matter), but that's probably more than you need (or want) to know.

Upvotes: 27

Chris Noe
Chris Noe

Reputation: 37221

No. DATE is a timestamp value with seconds precision. You need TIMESTAMP(3) to store milliseconds.

Upvotes: 1

Mostlyharmless
Mostlyharmless

Reputation: 2283

Apparently, not in form of millisecs.

Which actually makes sense, since they do not have any running operations on current date/time:

http://www.ixora.com.au/notes/date_representation.htm

http://infolab.stanford.edu/~ullman/fcdb/oracle/or-time.html

http://www.akadia.com/services/ora_date_time.html

Upvotes: 1

Related Questions