Solved

# how to convert dd/mm/yy to yy/mm/dd

Posted on 2010-11-08
559 Views
how to convert dd/mm/yy to yy/mm/dd
the date is string

thanks
0
Question by:yairab
• 3

Expert Comment

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.
0

LVL 14

Accepted Solution

sam2912 earned 500 total points

``````function convertDate(string) {

var date = string.split('/');

return date[2] + "/" + date[1] + "/" + date[0];

}
``````
0

LVL 13

Expert Comment

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

//-->
</script>
``````
0

LVL 14

Expert Comment

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];
}
</script>
``````
0

LVL 14

Expert Comment

Thanks for the points!
0

## Featured Post

### Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…