I have a oracle database backend linked to a C# Visual Studio Application.
I have a INVOICE table that stores a few Dates.
In the UI, i databind a DateTimePicker to these fields. The user selects both DATE and TIME. These values are stored to the database and are retriveable later, but i do not see the time in the Oracle interface.
C# DataSet Visualizer:
Oracle data view
Notice that both images are looking at the same table, first from Visual studio, and next from Oracle. The TIME is stored between sessions somewhere, as it can be retrieved and populates the user interface control which this column is bound to :
The problem is i want to run SQL in ORACLE and export the data to EXCEL, but since the TIME isn't visible in the ORACLE table, I cannot it for the EXCEL Report.
Is this a setting? or some weird caching issue or what?
The date field in oracle stores date and time based on the NLS settings. In order to provide output in a specified value you can use the to_char function and provide the format in which you need to display the date field. time_out is a date field in table.
Oracle's DATE datatype behaves as both an ANSI DATE and TIME datatype. This was a design decision that only Oracle knows the reasoning for. I'll add that Oracle isn't the only RDBMS that doesn't follow ANSI SQL standards in this way. Obviously, you can remove the time portion with TO_CHAR (departure_date,'DD-MM-YYYY').
This tells me that date is column is also storing time. This is unexpected. Shouldn't date type discard time value like an integer type discards fractional digits?
When using Oracle DATE or TIMESTAMP values, remember the following simple rules and you will probably avoid most of the common pitfalls. Both DATE and TIMESTAMP types *always* contain a date and time component. Never rely on implicit conversions of strings to dates, or dates to strings.
ok here is a gratuitous answer :)
please use the TO_CHAR
function to return the date in your desired format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With