Details
-
Improvement
-
Resolution: Fixed
-
Major
-
6.0.3
-
Medium
Description
Requirement is as follows:
{
|
"patientBirthDate": "19/08/2011 6:33:23"
|
}
|
We are trying to correct the date format to a standardised date format i.e. 2011-08-19 using an update query. Our initial idea was to use a query like below:
UPDATE patients SET patientBirthDate = DATE_FORMAT_STR(DATE_PARSE(patientBirthDate, 'dd/MM/yyyy h:mm:ss'), '1111-11-11') WHERE .... |
But to our surprise there was not inbuilt SQL function (e.g. DATE_PARSE) to parse a string into date using a format specifier. So had to resort to a string split and concat query for now.
UPDATE patients SET patientbirthDate = concat(split(split(patientbirthDate)[0], "/")[2], '-', split(split(patientbirthDate)[0], "/")[0] , |
'-', split(split(patientbirthDate)[0], "/")[1]) |
WHERE ... |
We feel this is a standard use case for any SQL engine.
Please let me know if there is such a function which we may have missed.