I'm trying to convert an SQR string from the following format of MM-DD-YYYY
into a format of YYMMDD
.
I've tried to use the following SQR function:
STRTODATE('03-09-2018', 'YYMMDD')
but I get the following error.
(SQR 7501) Using YY edit mask from (YYMMDD) against (03-09-2018)
(SQR 1914) Bad input data (12-01-2017) for edit mask: 'YYMMDD'
I think the problem is that the STRTODATE
function is expecting the YYMMDD
format, but the given format is in MM-DD-YYYY
.
Is there another SQR function which I can use to convert the formats?
The only other approach I can think of is splitting the string into sub-strings and re-create the string, but I don't want it to become messy.
This is what I'm trying to do:
Let $NewStr = STRTODATE('03-09-2018', 'YYMMDD')
Is there a specific SQR function which will do this for me?
You're after this: DATETOSTR(STRTODATE('03-09-2018', 'MM-DD-YYYY'), 'YYMMDD')
'MM-DD-YYYY'
string'YYMMDD'