We need to figure out current user date/time format in apex code to send it to our mobile app in order to display data in same way as it is in Salesforce itself. In other words, it's about getting template like YYYY-MM-dd or whatever based on current user's locale. And we are interested specifically in template, having just formatted date/time doesn't work - need a general template which would dictate rule how to format data for our mobile app.
Any help would be appreciated. Considering also non-apex-code solution as worst case scenario.
So far the only approach we've come up with is like this - tremendously ugly:
DateTime.newInstance(1999, 11, 10, 18, 49, 37).formatLong().replace('1999', 'YYYY').replace('11', 'MM').replace('10', 'dd').replace('18', 'HH').replace('06', 'hh').replace('6', 'hh').replace('49', 'mm').replace('37', 'ss').replaceFirst('((PM|pm|AM|am)\\\\s+)(.+)', '$1z').replaceFirst('AM|am|PM|pm', 'a');