Different systems accepts different formats of formating time. E.g.
- java, jquery: yyyy-MM-dd HH:mm
- some jquery plugins: yy-mm-dd HH:MM
- momentjs: YYYY-MM-DD HH:mm
- ISO-8601: YYYY-MM-DD hh:mm
On server I store time as Epoch time. And like to store some timeformat for user, so he see same format everywhere. But I just can't save and pass format string as it will be used differently. I saw various solutions, like restricting choice to 3-5 predefined options, and having list of these options in every system.
How to store time format and show formatted time-date to user in cost-effective way?
---- Example ----
I store time on server as 1412063513 value. In browser user want to see it as 2014-09-30 10:51. So he provide desired timeformat as 'YYYY-MM-DD HH:mm'. I save that format to server, but if i need to use it on server side (java) I got problems, as it is not valid due to capitalized letters. And when other systems trying to query data and format it, same problem arise.