to_char(LAST_STOCK_DATE, 'MON DD, YYYY HH24:MI') : Date Format « Date Timezone « Oracle PL / SQL






to_char(LAST_STOCK_DATE, 'MON DD, YYYY HH24:MI')

 
SQL>
SQL> CREATE TABLE product (
  2       product_name     VARCHAR2(25),
  3       product_price    NUMBER(4,2),
  4       quantity_on_hand NUMBER(5,0),
  5       last_stock_date  DATE);

Table created.

SQL>
SQL> INSERT INTO product VALUES ('Small Widget', 99, 1, '15-JAN-03');

1 row created.

SQL> INSERT INTO product VALUES ('Medium Widget', 75, 1000, '15-JAN-02');

1 row created.

SQL> INSERT INTO product VALUES ('Product Number', 50, 100, '15-JAN-03');

1 row created.

SQL> INSERT INTO product VALUES ('Round Church Station', 25, 10000, null);

1 row created.

SQL>
SQL>
SQL>
SQL>
SQL> select PRODUCT_NAME,
  2         PRODUCT_PRICE,
  3         QUANTITY_ON_HAND,
  4         to_char(LAST_STOCK_DATE, 'MON DD, YYYY HH24:MI') LAST_STOCK_DATE
  5  from   PRODUCT;

PRODUCT_NAME              PRODUCT_PRICE QUANTITY_ON_HAND LAST_STOCK_DATE
------------------------- ------------- ---------------- ------------------
Small Widget                         99                1 JAN 15, 2003 00:00
Medium Widget                        75             1000 JAN 15, 2002 00:00
Product Number                       50              100 JAN 15, 2003 00:00
Round Church Station                 25            10000

SQL>
SQL>
SQL>
SQL> DROP TABLE product;

Table dropped.

SQL>
SQL>

 








Related examples in the same category

1.format parameter options available
2.Change the original date format in the TO_CHAR function
3.to_char( sysdate, 'HH24:MI:SS' )
4.select to_char( sysdate, 'DD/MM/YY HH24:MI:SS' ) "Right Now"
5.select to_char(sysdate,'DD-MON-YY HH24:MI:SS' ) "Right Now"
6.Use to_char to format a date type column
7.Combine to_char and trunc with date value
8.to_char(order_date, 'hh24:mi:ss')
9.Use string returned to_char from date type column in where clause
10.Get the number of days in a month with to_char
11.Converting a DATE to Another Language
12.SELECT TO_CHAR(SYSDATE, 'MM-DD-YYYY HH24:MI:SS') NOW
13.TO_CHAR(SYSDATE, 'MONTH DDTH')
14.TO_CHAR(SYSDATE, 'MONTH DDSP')
15.TO_CHAR(SYSDATE, 'MONTH DDSPTH')
16.INITCAP(RTRIM(TO_CHAR(SYSDATE, 'MONTH'))) ||' ' ||TO_CHAR(SYSDATE, 'DDTH')
17.initcap(rtrim(to_char(sysdate, 'MONTH'))) ||' ' || initcap(to_char(sysdate, 'DDSPTH'))
18.INITCAP(RTRIM(TO_CHAR(SYSDATE, 'MONTH')))