RE: date format mask?

  • From: Eugene Pipko <eugene.pipko@xxxxxxxxxxxx>
  • To: 'Wolfgang Breitling' <breitliw@xxxxxxxxxxxxx>, "oratune@xxxxxxxxx" <oratune@xxxxxxxxx>
  • Date: Fri, 10 Jun 2011 08:30:39 -0700

Thanks a lot for your responses and the solution.
Learned something new.

From: Wolfgang Breitling [mailto:breitliw@xxxxxxxxxxxxx]
Sent: Thursday, June 09, 2011 6:25 PM
To: oratune@xxxxxxxxx
Cc: gus.spier@xxxxxxxxx; Eugene Pipko; oracle-l@xxxxxxxxxxxxx
Subject: Re: date format mask?

Why so complicated?

SQL> select 
to_date('2011-05-24T23:21:30.000Z','yyyy-mm-dd"T"hh24:mi:ss".000Z"') from dual;

TO_DATE('2011-05-24
-------------------
2011-05-24 23:21:30

1 row selected.

You can have any number and kind of additional characters in the dat mask. You 
just need to enclose them in "

On 2011-06-09, at 6:33 PM, David Fitzjarrell wrote:


SQL> begin
  2     :l_amazon_date := substr(translate('2011-05-24T23:21:30.000Z', 'TZ',' 
'),1, instr(translate('2011-05-24T23:21:30.000Z', 'TZ',' '),'.') - 1);
  3  end;
  4  /
PL/SQL procedure successfully completed.
SQL>
SQL> select TO_DATE(:l_amazon_date, 'YYYY-MM-DD HH24:MI:SS')
  2  from dual;


Other related posts: