Jump to content

If number not a date


Recommended Posts


The user enters a 4 digit number as a date.


Some examples:

0101 = 1st January
1902 = 19th Feb
2412 = 24th December

Is there a way I can perform an if function to tell if the number isn't a date? For exampe if the user enters the number e.g 0001, 4112, 0199?

I already make sure that it is a 4 digit number and not over 3112.




Link to comment
Share on other sites

It's pure coincidence that you can check for numbers > 3112 - if there was a 13th month with 30 days then >3013 wouldn't work. In principle you can only do comparisons like that if you have the data arranged in decreasing order of magnitude: MMDD.

Go ahead and use 3112 but you still need checkdate().


By the way, what are you going to do about 2902?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.