Solved

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

Posted on 2010-11-08
5
559 Views
Last Modified: 2012-08-14
how to convert dd/mm/yy to yy/mm/dd
the date is string

thanks
0
Comment
Question by:yairab
  • 3
5 Comments
 

Expert Comment

by:seshujosyula
Comment Utility
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

by:
sam2912 earned 500 total points
Comment Utility

function convertDate(string) {

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

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

}

Open in new window

0
 
LVL 13

Expert Comment

by:dsmile
Comment Utility

<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

0
 
LVL 14

Expert Comment

by:sam2912
Comment Utility
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

0
 
LVL 14

Expert Comment

by:sam2912
Comment Utility
Thanks for the points!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now