I have been provided with a file whereby the dates are in the aforementioned format.
I have never seen this format before so am I going to have to separate the data out and convert each section or is this actually a known format?
Cheers
I have been provided with a file whereby the dates are in the aforementioned format.
I have never seen this format before so am I going to have to separate the data out and convert each section or is this actually a known format?
Cheers
Most databases have some sort of to_date()
or parse_date()
functionality . . . except SQL Server.
If you are using SQL Server, then this should work:
select cast(stuff('10JAN2000:00:00:00', 10, 1, ' ') as datetime)
as suggested by others, knowing which database changes the answer. SQL Server isn't keen on supporting date parse function unlike oracle, please read through below threads, might help with better understanding-
Sql Server string to date conversion
In oracle of course, we can do something like this-
select to_date('10JAN2000:00:00:00', 'ddmonyyyy:hh24:mi:ss') from dual;
or
select to_timestamp('10JAN2000:00:00:00', 'ddmonyyyy:hh24:mi:ss') from dual;
select to_char(to_date('10JAN2000:00:00:00', 'ddmonyyyy:hh24:mi:ss'),'yyyy-mm-dd : hh:mm:ss') from dual;