As swmcdonnell already said, your question is kind of dublicated from:
oracle systimestamp (sysdate) to milliseconds
But you got an understanding problem. I did split your query into three columns.
SELECT TO_CHAR (SYSDATE, 'yyyymmddhh24miss'), -- Here we convert our sysdate into a 'string'
TO_NUMBER (TO_CHAR (SYSDATE, 'yyyymmddhh24miss')), -- this will output the resulting string as number - it will look the same as the 1st column
TO_NUMBER (TO_CHAR (SYSDATE, 'yyyymmddhh24miss')) * (24 * 60 * 60 * 1000) -- here you calculated 20180613150101 * 24 * 60... i think that's not what you want to do
FROM DUAL;
This doesn't make sense.
If you want the 'total-milliseconds' you have to:
- use current_timestamp instead of sysdate
- multiply the year (yyyy) by 365 days * 24 hours * 60 minutes * 60 seconds * 1000 ms
- multiply the day-of-year (DDD) by 24 hours * 60 minutes * 60 seconds * 1000 ms
- multiply the hour * 60 minutes * 60 seconds * 1000 ms
- multiply the minute * 60 seconds * 1000 ms
- multiply the second * 1000 ms
- add ms
This would result in something like this:
SELECT to_number(TO_CHAR (CURRENT_TIMESTAMP, 'yyyy')) * 365 * 24 * 60 * 60 * 1000
+ to_number(TO_CHAR (CURRENT_TIMESTAMP, 'DDD')) * 24 * 60 * 60 * 1000
+ to_number(TO_CHAR (CURRENT_TIMESTAMP, 'HH24')) * 60 * 60 * 1000
+ to_number(TO_CHAR (CURRENT_TIMESTAMP, 'mi')) * 60 * 1000
+ to_number(TO_CHAR (CURRENT_TIMESTAMP, 'ss')) * 1000
+ to_number(TO_CHAR (CURRENT_TIMESTAMP, 'FF'))
FROM DUAL;
.. But what are u going to do with it? I don't know Java but a Timestamp should not be displayed as interval. This would be something like interval in oracle or a timespan in C#.