Quick Search:
 
 Oracle PL/SQL: Date Functions: TO_CHAR Jump to:  
Category: >> Oracle PL/SQL >> Date Functions: TO_CHAR  

<< lastnext >>

Snippet Name: Date Functions: TO_CHAR

Description: Converts DATE and TIMESTAMP to VARCHAR2 with the specified format.

Also see:
» FUNCTIONS: date/time
» UPDATE: Update a partitioned table
» UPDATE: Update based on a record
» UPDATE: Update Object Table
» UPDATE: with RETURNING clause
» UPDATE: Nested Table Update example
» UPDATE: Correlated Update
» UPDATE: Update from a SELECT statement
» UPDATE: based on multiple returned val...
» UPDATE: Update based on a query
» UPDATE: Update multiple rows
» UPDATE: update a specific record
» UPDATE: Single row
» Date Functions: EXTRACT
» Date Functions: TO_DSINTERVAL
» Date Functions: TO_NCHAR
» Date Functions: TO_YMINTERVAL
» Date Functions: Calculate elapsed time...
» Date and Time Calculations: Get second...
» Date: Find first day of the month
» Date Calculations
» Date Functions: WHERE Clause Joins
» Date Functions: TRUNC
» Date Functions: SYSDATE
» Date Functions: ROUND
» Date Functions: NEXT_DAY
» Date Functions: NEW_TIME
» Date Functions: MONTHS_BETWEEN
» Date Functions: MIN
» Date Functions: MAX

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 03rd, 2009

TO_DATE(<date_string>, <format mask>, <NLS_PARAMETER>)
 
SELECT TO_CHAR(datecol1, 'DAY-MONTH-YY') COL1,
TO_CHAR(datecol2, 'D-MM/YYYY HH24:MI:SS') COL2,
TO_CHAR(datecol2, 'YYYY-MON-DD HH24') COL3
FROM t;
 
--Demo of FM Formatting From Tom Kyte (Oracle Magazine 3-4/2004) 
 
    SELECT TO_CHAR(dt, 'HH:MI AM') A,
       TO_CHAR(dt, 'FMHH:MI AM') B,
       TO_CHAR(dt, 'FMHHFM:MI AM') C
FROM (
  SELECT TO_DATE('09:01 am', 'HH:MI AM') dt
  FROM dual);


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org