0

In MySQL :

CREATE TABLE t_users (username VARCHAR(30), password VARCHAR(30), date_added(DATE))

As I know for default format date in MySQL is like this : 2013-06-24

That worked.

Now I create table in ORACLE :

CREATE TABLE T_USERS (USERNAME VARCHAR(30), PASSWORD VARCHAR(30), DATE_ADDED(DATE))

My question is :
1. What is default date format in oracle ?
2. Can I use format like MySQL date format like this : 2013-06-24 ?

Please, need your advice. Thank you

Interval Grid
  • 187
  • 3
  • 14
  • 2
    The short answer would be: try it and see, but this question may be helpful: http://stackoverflow.com/questions/1837974/oracles-default-date-format-is-yyyy-mm-dd-oh-dear-god-why . (It's also the first result I get when I google "default oracle date format".) –  Jun 24 '13 at 10:37
  • 1
    Do you mean to ask if you can use the ISO-8601 date format? if so, then yes, you do it like this `date '2013-06-24'` – A.B.Cade Jun 24 '13 at 11:09

1 Answers1

0

After connecting to oracle you can alter your session:

SQL> SELECT SYSDATE FROM DUAL;

SYSDATE
---------
24-JUN-13

SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD';

Session altered.

SQL> SELECT SYSDATE FROM DUAL;

SYSDATE
----------
2013-06-24

You have to run it after new connection is established.

In order to display it in different way in Oracle SQL Developer:

Tools -> Preferences -> Database -> NLS -> Date Format

the_slk
  • 2,172
  • 1
  • 11
  • 10