I want to convert a date to a string, and sees that Sencha 2 has this class for the job. It has a lot of convertion, but I cant find anyone where I can customize how I want the string formatted. I want a date in ‘dd-MM-yyyy’.
In java you have the SimpleDateFormat class where you give the pattern you want it formated in as parameter, I would except there was something like this in the Date class. If not, whats the best way to do this in pure javascript (no third part libraries), I know the trivial way (getFullYear(), getMonth() and such), but its error prone.
http://docs.sencha.com/touch/2-0/#!/api/Date-method-toDateString
have a look at http://docs-devel.sencha.com/touch/2-0/#!/api/Ext.Date
it contains a ton of the format options 🙂
Cheers, Oleg