Alright. I'd actually love to use that format everywhere. What I don't understand is what is changing it from that. I guess this isn't a SetJSONData issue but a FireDAC issue. Or even more likely an issue somewhere in my understanding of this.
I've got a date field from a DB2 database if that matters (same issues with datetime field). When I create an FDQuery in the IDE and leave it with the default FormatOptions, the query editor displays a date format of 'yyyy-mm-dd'. All good.
If I change the FDQuery's FormatOptions to something else, like yyyyMMMdd (on the options tab of the FDQuery), the query editor correctly displays that date format. Also all good.
However, everywhere else, including a DBGrid at designtime, a DBGrid at run-time, (field.AsString), etc. the yyyy-mm-dd format is used when displaying the data. Doesn't seem to matter what I do, other than overriding it in the field displayformat, it remains the same.
EXCEPT whenever I try to use the FireDAC savetostream function or the JSONWriter component, it ends up in yyyymmdd format. No clue as to why.
I've been fiddling with the (FDManager | FDConnection | FDQuery).FormatOptions.FormatDate values but nothing seems to have any effect. The only time I see a change is in the FDQuery's editor when viewing query results.
All I'm doing to get the data at runtime is something like
I don't do anything with the fields - don't know/care how many or what types they are, just want it to output them. I'd have thought the default formatting should be used but nothing I do seems to change that default and I have no clue as to where the yyyymmdd format is introduced anywhere. JSONWriter has an option for DateTime but it defaults to ISO which should be yyyy-mm-ddThh:nn:ss. Super annoying.
Sorry, not really a WebCore / XData / TMS issue at this stage I suppose!