yairab
asked on
how to convert dd/mm/yy to yy/mm/dd
how to convert dd/mm/yy to yy/mm/dd
the date is string
thanks
the date is string
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<script language="JavaScript">
<!--
strDate= '09/02/10';
var strNewDate = strDate.substring(6,10) + '/' + strDate.substring(3,5) + '/' + strDate.substring(0,2);
alert(strNewDate);
//-->
</script>
Here's the implementation. By the way, this works even if the date is without leading zeroes, i.e.: 1/1/10
<script type="text/javascript">
function convertDate(string) {
var date = string.split('/');
return date[2] + "/" + date[1] + "/" + date[0];
}
alert( convertDate("08/11/10") );
</script>
Thanks for the points!
-> Change date and Time Settings -> Again, Change date and Time Settings -> Change calender settings -> From the drop down for Short date; Select yyyy -mm -dd . Apply and ok.
P.S: I've checked these settings from Windows 7. Some options may differ in other operating systems.