Formatting date in SQL (Oracle) -Simple date formatting

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

Here is few simple SQL date formatting examples that can be useful while displaying dates in different formats.There are a number of formatting techniques available for dates and timestamps.
1. DD:MONTH:YYYY HH24:MI:SS format

SQL> select distinct to_char(sysdate,'DD:MONTH:YYYY hh12:MI:ss') TIME_NOW from tab;

TIME_NOW
28:OCTOBER  :2008 04:37:12

2. Year in strings

SQ> select distinct to_char(sysdate,'DD-MONTH-YEAR hh12:mm:ss') today from tab;
TODAY
28-OCTOBER  -TWO THOUSAND EIGHT 04:10:40

3. Day and date as string

SQL> select distinct to_char(sysdate,'DAY DD--MONTH--YEAR hh12:mm:ss') today from tab;
TODAY
TUESDAY   28--OCTOBER  --TWO THOUSAND EIGHT 04:10:09

Related articles on oracle DATE , TIMESTAMP etc

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

2 thoughts on “Formatting date in SQL (Oracle) -Simple date formatting

  1. Pingback: Oracle Tablespace, and Datafiles - Introduction | SQL and PLSQL

  2. Pingback: DATE Data type in Oracle|Oracle Dates and Times|Dates in OracleDATE Data type in Oracle|Oracle Dates and Times|Dates in Oracle | SQL and PLSQL

Leave a Reply

Your email address will not be published. Required fields are marked *

Paged comment generated by AJAX Comment Page