tags:

views:

73

answers:

5

Hello,

I have a string : 30/09/2010 and I'd like have 09/30/2010 hiw can I do this useing jQuery ?

Thanks,

+2  A: 

Actually not a jquery solution but datejs is a great framework for handling dates in javascript.

Darin Dimitrov
+1  A: 

There is nothing in the jQuery library for that. You can use simple string operations in Javascript:

var s = '30/09/2010';

s = s.substr(3,2) + '/' + s.substr(0,2) + s.substr(6);
Guffa
+3  A: 

You no need Jquery it's very simple code :

var s_date = '30/09/2010'.split("/");
var org_date = s_date[1] + "/" + s_date[0] + "/" + s_date[2];
john misoskian
+1 just like what i have in mind.
Reigel
A: 

There is a jquery datapicker at http://jqueryui.com/demos/datepicker/

It has a few static methods that may be of use to you, and would allow you to do something like:

var dstr = $.datepicker.formatDate('mm/dd/yy', 
                    $.datepicker.parseDate('dd/mm/yy', '30/09/2010'));
zod
A: 

Try using the Date object:

var Stamp = '30/09/2010'.split("/");;
var Date = new Date(Stamp[2],Stamp[1],Stamp[0]); //(year,month,day)

Then use the format command like so:

Date.format("mm/dd/yy"); //Gives | 09/30/2010
RobertPitt