You can find this is a cheeky trick, but it works as a treat :)

select
  printf('%s-%02.0f-%s',
         substr(started_dt,1,2),
         (2+instr('JanFebMarAprMayJunJulAugSepOctNovDec',
substr(started_dt,4,3)))/3,
         substr(started_dt,8,4)
  )



On 13 June 2014 10:01, Krishnan Narayanan <krishnan.sm...@gmail.com> wrote:

> Hi All,
>
> I have my date format as 08-Mar-2014 how to I change it to 08-03-2014?
> Can I use regexp_replace.
>
> I tried below but not getting the desired output.
>
>
> regexp_replace(started_dt,"\Jan|\Feb|\Mar|\Apr|\May|\Jun|\Jul|\Aug|\Sep|\Oct|\Nov|\Dec","\01|\02|\03|\04|\05|\06|\07|\08|\09|\10|\11|\12")
>
> Output: 09-1|2|3|4|5|6|7|8|9|10|11|12-2014 16:19:56.
> Help is much appreciated.
>
>
> Thanks
> Krishnan
>
>


-- 
André Araújo
Big Data Consultant/Solutions Architect
The Pythian Group - Australia - www.pythian.com

Office (calls from within Australia): 1300 366 021 x1270
Office (international): +61 2 8016 7000  x270 *OR* +1 613 565 8696   x1270
Mobile: +61 410 323 559
Fax: +61 2 9805 0544
IM: pythianaraujo @ AIM/MSN/Y! or ara...@pythian.com @ GTalk

“Success is not about standing at the top, it's the steps you leave behind.”
— Iker Pou (rock climber)

-- 


--



Reply via email to