use DateTime::Format::Oracle;
$ENV{NLS_TIMESTAMP_FORMAT} = 'DD-MON-RR HH.MI.SSXFF AM';
$s = '15-FEB-03 02.39.06.167901 PM';
$dt = DateTime::Format::Oracle->parse_timestamp($s);
print $dt->nanosecond, "\n";
The above prints 167901000.
Trying to get a full nanosecond and not just microsecond:
$ENV{NLS_TIMESTAMP_FORMAT} = 'DD-MON-RR HH.MI.SSXFF9 AM'; # Note
the 9
$s = '15-FEB-03 02.39.06.167901987 PM';
$dt = DateTime::Format::Oracle->parse_timestamp($s);
print $dt->nanosecond, "\n";
This fails with:
Invalid date format: 15-FEB-03 02.39.06.167901987 PM at
/Library/Perl/5.10.0/DateTime/Format/Oracle.pm line 161
According to this site:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924
one should be able to have the 9 after the FF.
Am I missing something?