Solved

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

Posted on 2010-11-08
5
563 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
ID: 34084318
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
ID: 34084375

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
ID: 34084415

<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
ID: 34084720
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
ID: 34084726
Thanks for the points!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how can apply the following conditionals: 5 31
how can i count words? 2 42
how to avoid redundand ajax calls 5 28
how to handle long text strings in javascript or ajax 1 29
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

774 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