I'm not clear on what you mean. If you were to have this value:
Wed Dec 10 00:00:00 UTC+0530 2008
(which incidentally is actually the 9th in all points west of its time zone locale, including Greenwich due to the UTC value, which could be stripped if desired) in a variable, you could feed it to the Date() method and then extract whatever you need from the object created, ex:
Code:
var dateData='Wed Dec 10 00:00:00 UTC+0530 2008';
var dt=new Date(dateData);
var d,m,y;
d=dt.getDate().toString(10);
d=d.length==1? '0'+d : d;
m=(dt.getMonth()+1).toString(10);
m=m.length==1? '0'+m : m;
y=dt.getFullYear();
alert(d + '/' + m + '/' +y);
Or stripping the UTC component:
Code:
var dateData='Wed May 9 00:00:00 UTC+0530 2008';
var dt=new Date(dateData.replace(/UTC[^\x20]*/,''));
var d,m,y;
d=dt.getDate().toString(10);
d=d.length==1? '0'+d : d;
m=(dt.getMonth()+1).toString(10);
m=m.length==1? '0'+m : m;
y=dt.getFullYear();
alert(d + '/' + m + '/' +y);
However, this is all client side javascript, which might not be available. And, as I said, if the UTC component is not stripped, depending upon the locale of the user, the precise day of the month, and hence the date (dd or d part) might be +/- 1.
Bookmarks