Compare user date with system date

Discussion in 'Javascript' started by Robert Scheer, Jul 20, 2004.

  1. Hi.

    My user types a date on a textbox using the DD/MM/YYYY format. I need
    to verify that this date is not older than 2 months ago. Have seen
    some functions to test dates but not with the above format.

    Thanks,
    Robert Scheer
     
    Robert Scheer, Jul 20, 2004
    #1
    1. Advertisements

  2. JRS: In article <>,
    dated Mon, 19 Jul 2004 19:13:56, seen in news:comp.lang.javascript,
    Robert Scheer <> posted :

    >My user types a date on a textbox using the DD/MM/YYYY format. I need
    >to verify that this date is not older than 2 months ago. Have seen
    >some functions to test dates but not with the above format.


    Did you not find the newsgroup FAQ sufficiently helpful?

    See below.



    YYYY/MM/DD would be better; if you are sure that the form will be either
    DD/MM/YYYY or YYYY/MM/DD, then the following will convert the former to
    the latter if needed - I think :-

    S = S.replace(/^(\d\d)\/(\d\d)\/(\d\d\d\d)$/, "$3/$2/$1")

    You will need to think about "two months ago" for Aug 31 and for April
    29; if you have authority, it would be easier to use 60 days.

    Do not let the result be adversely affected by Summer Time.

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
    <URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang.javascript
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
     
    Dr John Stockton, Jul 20, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James P.
    Replies:
    7
    Views:
    13,541
    phamtasmic
    Jul 13, 2004
  2. Paul King

    WHERE Date > System Date

    Paul King, Jul 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    405
    Paul King
    Jul 21, 2004
  3. CZ
    Replies:
    1
    Views:
    819
    Jack Li
    Sep 23, 2005
  4. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,787
    Michael Borgwardt
    May 30, 2004
  5. Shailesh Katti

    compare validator to validate date in user control

    Shailesh Katti, Jul 27, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    1,185
    Teemu Keiski
    Jul 28, 2003
  6. Michael Haas

    compare date field to current date

    Michael Haas, Feb 15, 2004, in forum: ASP General
    Replies:
    4
    Views:
    441
    Mike Haas
    Feb 15, 2004
  7. Scott Knapp

    Compare Input Date to Server Date

    Scott Knapp, Oct 2, 2003, in forum: Javascript
    Replies:
    2
    Views:
    323
    Dr John Stockton
    Oct 2, 2003
  8. joeyej
    Replies:
    7
    Views:
    376
    Randy Webb
    Apr 6, 2006
Loading...