Fix for Point in Time RMAN recovery error ORA-01841

I got this error during a recover process of an Oracle database using point in time recovery. Point in time recovery will work when your have you database run in archive log mode. The initial Script i have used :

run {
set until time "to_date('15122014 20:00','ddmmyyyy hh24:mi')"; -- problem was here
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=SRVDB01-bkp-bd,NB_ORA_POLICY=SRV01-Oracle-DB2-SRVDB01,NB_ORA_SERV=SRV01,NB_ORA_SCHED=Default-Application-Backup';
restore database;
switch datafile all;
switch tempfile all;
recover database;
}
The received error message
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
 start until time 'DEC 15 2014 20:00:00' using backup controlfile
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
To fix this error i had to specify the NLS_DATE_FORMAT mask values inside the RMAN session
run {
sql 'alter session set NLS_DATE_FORMAT="DD.MM.YYYY HH24:MI:SS"'; --added sql line
set until time='15.12.2014 20:00:00';
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=SRVDB01-bkp-bd,NB_ORA_POLICY=SRV01-Oracle-DB2-SRVDB01,NB_ORA_SERV=SRV01,NB_ORA_SCHED=Default-Application-Backup';
restore database;
switch datafile all;
switch tempfile all;
recover database;
}
I hope this was helpfull.