Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 27th, 2005, 10:11 AM
Authorized User
Join Date: Sep 2004
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default JavaScript and Date Edits

Good morning all.

I'm in the process of converting my VB Script form editing code to JavaScript.

I need to create two edits:

1) Check for valid date.

   In VB script I would use this code:

        if isdate(strDate) then..................

    is there an equivalent in JavaScript?

2) Determine time span between dates.

    In VB script I would use this code:

        if datediff("D",now,strdate) > 0 then...............

    is there an equivalent in JavaScript?

Thank you for your help!


Old January 27th, 2005, 01:27 PM
Friend of Wrox
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts

Please check the following link:


Om Prakash
Old January 30th, 2005, 02:59 PM
Authorized User
Join Date: Jan 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts

i didnt get your first question ... do u mean to check the date from a user input in form or other means?? i wasn't clear about that

but regards to your second question... here is a possible solution:

suppose you want to find the difference of time between jan 10 1990 and jan 10 2000, here is what your could do :

var fDate=new Date("10 Jan 1990");
var sDate=new Date("10 Jan 2000");

var dateDiff=(sDate.valueOf()-fDate.valueOf());

/*the variable dateDiff now contains the difference between the two dates in milliseconds, which you can convert to any required time unit...all done by the valueOf() method of the date object */

Old February 2nd, 2005, 01:32 AM
Friend of Wrox
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel

1.For your first query :: http://www.codetoad.com/forum/17_10053.asp
2. For your second query :: http://www.flws.com.au/showusyourcod...ff.asp?catID=2 or http://www.experts-exchange.com/Web/..._20483408.html

Best Regards


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allow Edits In SubForm tready Access VBA 1 December 19th, 2005 08:41 AM
Date object javascript marclena Javascript How-To 2 September 10th, 2004 10:15 AM
Form Data Edits bph Access VBA 6 January 26th, 2004 11:12 AM
Access edits kev_79 Access ASP 2 September 23rd, 2003 11:50 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.