Dating sq ru
I went with a combination of holden321 and mwrf's answers.
Storing the formats external to the function because it's handier that way and storing the current locale format because it's always useful.
Date Time Format("en-US"); console.log( formatter.format(date) ); // There is no easy way.
If you want a reliable, cross-browser solution, you'd have to build a lookup table of date, and time format strings, by culture.
We strongly recommend you to arrive within the first month of your visa validity.
Date Time Format("ru"); console.log( formatter.format(date) ); // var formatter = new Intl.
That's a lot of work when you don't even know if it's the correct locale (I'd bet that international language headers are often incorrect or not specific enough), or if the user has customized the format to something else.
You can try using client VBScript (which has functions for all of these regional formatting permutations), but that's not a good idea because it's a dying (dead? You can also try using Java/Flash/Silverlight to dig up the format.
To format a date, parse the corresponding format string, extract the relevant parts from the date, i.e. This is essentially what Microsoft does with their AJAX library, as shown in @no's answer.
Found this thread while looking for a way to generate localized but short dates in all browsers without any extra library, just a simple call to format server generated ISO dates.