unable to Work with the JavaScript's Date function


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: unable to Work with the JavaScript's Date function

  1. #1
    Join Date
    Mar 2005
    Posts
    21

    Unhappy unable to Work with the JavaScript's Date function

    Dear all,
    I hope that this is the right section to place this thread.
    I am using the JavaScript's Date Function to do some validation on my form but when ever I want to print the converted date into an alter it says "NaN".
    My form have 4 drop down lists namely 'lstDay1' (Contains day of month like 02), 'lstMonth1' (Contains month like "Nov"), 'lstYear' (Contains Year like 2006) and 'lstTime1' (Contains Time like 4 PM format).
    I wish to convert this date as 02/Nov/2006 16:00:00 format using javaScript's datefunction. I am using the following javaScript :

    function DisplayDate()
    {
    var strDateTime = new Date();
    var strDate;

    var strDD = "02" //document.getElementById('lstDay1').value;
    var strMM = "Nov" //document.getElementById('lstMonth1').value;
    var strYY = "2006" //document.getElementById('lstYear').value;

    var strTime = "4 PM" //document.getElementById('lstTime1').value;
    strDate=strDD+"/"+strMM+"/"+ strYY;
    alert("Date : " + strDate); //It Prints "02/Nov/2006"

    strDateTime = Date.parse(strDate);
    alert("Converted Date : "+strDateTime.toString()); //Here it prints NaN
    }
    I don't know how to convert Time of format 4 PM to hh:mm:ss format.
    An early reply will highly appriciated.
    Last edited by rajat_sharma69; 10-23-2006 at 05:38 AM.
    Innovation Makes Life Better.

Similar Threads

  1. Replies: 2
    Last Post: 06-05-2001, 01:55 PM
  2. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 12:11 PM
  3. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 0
    Last Post: 08-10-2000, 09:16 PM
  4. Please help me -- urgent -- deadlock error
    By chandra in forum VB Classic
    Replies: 0
    Last Post: 06-22-2000, 07:36 AM
  5. Replies: 0
    Last Post: 06-22-2000, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center