Click here to Skip to main content
13,006,360 members (79,654 online)
Rate this:
Please Sign up or sign in to vote.
See more:
var CurDate = "2011.20.11";
var CDate = new Date(CurDate);

i have also try var CDate = (new Date(CurDate)).format("");
also Date.format("") but nothing work..
When i use Cdate it will return error as invaliddate().

please help me in this...

Posted 25-Apr-11 7:09am
Updated 25-Apr-11 16:01pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This[^] could help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

use Date.parseDate(dateValue,format) method.

var d = Date.parseDate("2005-10-05 12:13 am", "Y-m-d g:i a");
document.write(d + "\n");
var d = Date.parseDate("9/5/05", "n/j/y");
document.write(d + "\n");
jatinchandarana 25-Apr-11 13:25pm
Not Working....
When i write var d= Date.parseDate("2011.11.02","");
it gives me this error
TypeError: Date.parseDate is not a function
Wonde Tadesse 6-Dec-11 10:22am
Just refer the following date format options.
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

Add these two script file in your page
if you don't have these Script plugin then go through these link and download it first.


And try like this it will work 100%

 <script language="javascript" type="text/javascript" src="~/Scripts/date.js"></script>
    <script language="javascript" type="text/javascript" src="~/Scripts/time.js"></script>

var today =;
        var $startDate = $('#EndDateConsumption');
        var $endDate = $('#StartDateConsumption');
        var dStartDate = Date.parseExact($startDate.val(), "MM/dd/yyyy");
        var prevDate = dStartDate.add(-1).months();

Enjoy :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170628.1 | Last Updated 25 Sep 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100