Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:29:37+00:00 2026-06-05T02:29:37+00:00

I am using the following code: var date=May-02-2012; var startDate = date; var tmp

  • 0

I am using the following code:

var date="May-02-2012";
var startDate = date; 
var tmp = startDate.split('-'); 
tmp.splice(1, 0, ','); 
var convertedStartDate = new Date(tmp.join(' ')); 
var month = convertedStartDate.getMonth() + 1 
var day = convertedStartDate.getDate(); 
var year = convertedStartDate.getFullYear(); 
var shortStartDate = ('0' + day).slice(-2) + "-" + ('0' + month).slice(-2) + "-" + ('0' + year).slice(-2); 
return(shortStartDate);

The code above allows my to convert May-02-2012 to 02-05-12

however, I now need to convert it from 02-05-12 back to May-02-2012

But I can’t work it out..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:29:38+00:00Added an answer on June 5, 2026 at 2:29 am

    No too hard provided the format is as you specified. The following doesn’t do any testing so if the format is wrong, it might to awry. But so will any function if you give it the wrong format.

    var s = '02-05-12';
    
    function toWeirdDate(s) {
       var months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
       var bits = s.split('-');
       return months[--bits[1]] + '-' + bits[0] + '-20' + bits[2];
    }
    
    alert(toWeirdDate(s)); // May-02-2012
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running the following code, I get an exception: using (var client = new Pop3Client())
I have multiple instances of the following code. var start_time = new Date().getTime(); setTimeout(function
I am using the following code... var Graphs:Array = new Array(contentMain.graph1, contentMain.graph2, contentMain.graph3, contentMain.graph4,
How to add date is where clause. I am using following code. var opportunites
using aptana studio 3, I found the following has no code assist var myDate=new
Given the following code: using (var client = new WebClient()) { string url =
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using the following JavaScript code: var a = [23, 34, 45, 33];
I am using ASP.NET 3.5 with iTextSharp and I have the following code: var
I am using the following code to submit different values var evalue= 'color:#d32;font-size:12px;'; jQuery.ajax({

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.