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 8449985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:51:01+00:00 2026-06-10T10:51:01+00:00

date validation in classic asp i am new in classic asp and having problem

  • 0

date validation in classic asp

i am new in classic asp and having problem in validating the date

dim Day,Month,Year,FullDate
Day = "01"
Month = "20"
Year = "2012"
FullDate = Month + "/" + Day + "/" + Year

document.write FullDate
document.write IsDate(FullDate)
document.write IsDate(CDate(FullDate))
document.write IsDate(20/01/2012)

output :

20/01/2012
true true false
  • 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-10T10:51:02+00:00Added an answer on June 10, 2026 at 10:51 am

    If you’re asking why document.write IsDate(20/01/2012) doesn’t write true the reason is because you’ve asked the computer to do division, then evaluate that as a date.

    20/01 = 20 => 20/2012 ~= 0.01

    IsDate(0.01) => false

    If you really want to test what you’ve got try this instead (small tweak)

    Your: document.write IsDate(20/01/2012)
    Mine: document.write IsDate("20/01/2012")
    

    Also, just for clarification http://en.wikipedia.org/wiki/Date_format_by_country

    Some countries use

    dd/mm/yyyy
    

    and some places use

    mm/dd/yyyy
    

    and that’s why the International Standards Organization suggests you do things with least specificity to most specificity:

    yyyy-mm-dd hh:mm:ss.ffffffffffff
    

    Notice that’s Years -> Months (which month is more specific than which year) -> Days (which day an event occurs on is helpful) -> Hours (don’t be late!) -> Minutes (saved by the bell?) -> Seconds (Now you have some idea when it happened) -> fractions of a second (Olympic Swimming!!)

    Years are rather non-specific. Lots of things happen in one year. So those should always parse first. The ISO way is the preferred way to pass Date information, and when the year does not come first, the system tries to guess intelligently. Since some parts of the world do dmy and some do mdy and since only one of your starting two numbers is over 12, it assumes you mean dmy instead of mdy. No WTF here.


    For the record, here are a list of countries which predominantly put the month first as a matter of tradition in mdy format (excluding ISO formatting which is not tradition, but science)

    • Belize
    • Federated States of Micronesia
    • Palau
    • United States of America

    And finally if you want to write a function that will try and reparse the date for you:

    Consider that people tend to break the date with either spaces, periods, hyphens or slashes, they may write it as “20120817” or they may include the time as well. There may be a T in the middle, and it may have a Z at the end.

    Sample inputs: (and the date they represent)

    2011-08-17 (august 17th)
    2011-08-01 (august 1st or jan 8th?)
    08-01-2011 (august 1st or jan 8th?)
    08-17-2011 (august 17th)
    17-08-2011 (august 17th)
    2011-17-08 (I've never seen this ever)
    
    2011/08/17 (august 17th)
    2011.08.01 (august 1st or jan 8th?)
    08\01\2011 (august 1st or jan 8th?)
    08-17-2011 (august 17th)
    17 08 2011 (august 17th)
    

    As you can see, there’s a fair bit of parsing that has to happen here, and that’s to assume that they have a 10 digit string and that that 10 digits is a date. Here are some other date formats:

    08-01-12   (was that January 8th, 2012 or January 12th, 2008 or August 1st, 2012 ...)
    15-03-13   (ok, so we have found the month is March, but the other two?)
    1-1-1
    8-8-8      (these two are easy, but which rule do they match?)
    

    And then you have to parse

    20120817
    20121708
    20120801
    01082012
    08172012
    

    So as you can see, parsing the function seems easy but there’s a lot to consider, and this is JUST dates. Want to let’s talk about times next?

    201208171311   -> 2012-08-17 13:11    (1:11 PM)
    20120817T1311  -> 2012-08-17 13:11    (1:11 PM)
    20120817T0111P -> 2012-08-17 01:11 PM
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Date validation in PHP? date validation for year, month, day each separate.
Date validation is not working properly. If day = 90, month = 1 and
In my CakePHP-1.2 application, I am using the date format 01-Jan-2012 Which date validation
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
In my asp page, i write code like this for checking date validation <%
If I have the following validation: validates_inclusion_of :dob, :in => Date.new(1900)..Time.now.years_ago(18).to_date, :message => You
I need to do some validation in classic asp on some user-supplied strings to
I'm trying to add some Input Validation in Classic ASP by using the function/code
Im trying to to set up a php date validation (MM/DD/YYYY) but I'm having
I am converting an ASP application to PHP and am having difficulty transcribing date

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.