Question

I need to just show the date stamp when used as an information field, but out of the box functionality shows both date and time stamp. Is there a way, I can only show date stamp and not time stamp. Is there a way I can add a side effect

For example: Implemenation date: 7/17/13 12:00 AM (This is how it is right now) Implemenation date: 7:17/13 (I want it to be displayed like this)

Thanks

Chetan

Was it helpful?

Solution

The answer is not obvious, as some critical details are missing. The main one being, what client program is retrieving and displaying the data? That's where the change needs to be made. Oracle stores date and time in a variety of datatypes, but regardless of datatype (DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, etc), the date is stored in an internal format in the database. When a date is selected from the database, it's up to the client program to decide how to display the information.

For example, if the client program is SQL*Plus, you can set NLS_DATE_FORMAT to control how a date is displayed.

For example:

-bash-4.1$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Nov 19 10:38:49 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter nls_date_format

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
nls_date_format              string
SQL> select sysdate from dual;

SYSDATE
---------
19-NOV-13

SQL> alter session set nls_Date_format = 'mm:dd/yy';   

Session altered.

SQL> select sysdate from dual;

SYSDATE
--------
11:19/13

So, that's an example for SQL*Plus client. You need to determine how to set the date format for your client, which you have thus far, not specified.

Hope that helps...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top