I have a date returned in this format YYYY-MM-DD, e.g. 2011-04-29. Using jQuery how can I make the dat开发者_StackOverflowe 29-04-2011?
You can use .reverse()
var pieces = '2011-07-27'.split('-');
pieces.reverse();
var reversed = pieces.join('-');
var parts = '2011-07-27'.split(/-/);
parts.reverse();
alert(parts.join('-'));
精彩评论