Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PLSQL convert date from string '300520231644' to '30/05/2023 16:44'

PLSQL convert date from string ‘300520231644’ to ’30/05/2023 16:44′

Hi seniors
Plesae advice or assist to convert string to char to date
from string ‘300520231644’ to date ’30/05/2023 16:44′

I tried to use this code below

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

SELECT to_date('3005231429', 'dd/mm/yyyy hh:mi:ss') FROM dual;

thanks in advance

>Solution :

You can do it using TO_TIMESTAMP to convert string into datetime, then TO_CHAR to convert datetime into the format needed :

SELECT to_char(TO_TIMESTAMP('3005231429', 'ddmmyyHH24mi'), 'dd/mm/yyyy HH24:mi') FROM dual;

Demo here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading