Oracle modifies the default time format

Source: Internet
Author: User
Insert the current date to Oracle (sysdate is used). The time is accurate to the current day. The current time format is the default time format of Oracle.

Insert the current date to Oracle (sysdate is used). The time is accurate to the current day. The current time format is the default time format of Oracle.

1. Insert the current time to the database

Insert the current date to Oracle (sysdate)

Example: insert into table (date) value (sysdate); // insert the system time and date

The time is accurate to the day. The current time format is the default time format of Oracle.

DD-MON-RR)

1. Temporarily modify the default Oracle time

Change the default time format of Oracle:

SQL> alter session set nls_date_format = 'yyyy-mm-dd ';

2012-12-10

YYYY: MM: DD HH24: MI: SS this is accurate to the second format

The session has been changed.

This is only a temporary modification time format. If the server is restarted, the default time format is still the original

2. Change the time format permanently:

In the Registry's KEY_LOCAL_MACHINE-> SOFTWARE-> ORACLE-> HOME0

Add the string value NLS_DATE_FORMAT. Set it to YYYY-MM-DD-HH24: MI: SS.

For example, modify the parameter file. You can add the following in the parameter file:

NLS_DATA_FORMAT = YYYY-MM-DD-HH24: MI: SS, but the NLS_LANG string value at the preceding position in the registry must be removed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.