Wednesday, October 03, 2007

Convert a stats input date to Edward date_sid

Old way of doing it:
select to_char(to_date('09/01/2007', 'MM/DD/YYYY'), 'YYYYMMDD') from dual;

New way with regexp
select regexp_replace('09/01/2007', '(\d{2})/(\d{2})/(\d{4})', '\3\2\1') from dual

reduced function call to 1

1 comment:

Unknown said...

Okay, this won't help you unless you work at YSM! ;)