Link to home
Start Free TrialLog in
Avatar of yairab
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
Avatar of seshujosyula
seshujosyula
Flag of United Kingdom of Great Britain and Northern Ireland image

You click on the date and time on the bottom right of your screen.
-> 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.
ASKER CERTIFIED SOLUTION
Avatar of Samuel Liew
Samuel Liew
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

<script language="JavaScript">
<!--
strDate= '09/02/10';
var strNewDate = strDate.substring(6,10) + '/' + strDate.substring(3,5) + '/' + strDate.substring(0,2); 
alert(strNewDate);

//-->
</script>

Open in new window

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>

Open in new window

Thanks for the points!