Home » SQL & PL/SQL » SQL & PL/SQL » Validate Year
Validate Year [message #155811] Wed, 18 January 2006 15:19 Go to next message
Duane
Messages: 588
Registered: December 2002
Senior Member
I'm just seeing if anyone has come up with a way to validate/check a year so that it is somewhat current?

A web form allows you to enter a date, such as, MM/DD/YYYY and the person enters 01/20/0006 instead of 01/20/2006. Besides seeing if the year < 2000, is there any other way?

[Updated on: Wed, 18 January 2006 15:26]

Report message to a moderator

Re: Validate Year [message #155848 is a reply to message #155811] Wed, 18 January 2006 22:46 Go to previous messageGo to next message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
Quote:

Besides seeing if the year < 2000, is there any other way?
No, you simply need to codify your definition of "somewhat current".
Re: Validate Year [message #155889 is a reply to message #155811] Thu, 19 January 2006 09:01 Go to previous messageGo to next message
Duane
Messages: 588
Registered: December 2002
Senior Member
I was meaning current century. The date, 01/20/0006, is a valid date but not for this current century. I was just looking at what I could do to let the user know that the date entered is not within this century.
Re: Validate Year [message #155892 is a reply to message #155889] Thu, 19 January 2006 09:30 Go to previous messageGo to next message
d.fowler
Messages: 21
Registered: January 2006
Location: Missouri
Junior Member

If you could limit web form to two digit year. Use RR format
e.g.

select to_char(to_date('01/20/06','mm/dd/rr'),'mm/dd/yyyy') yr from dual
Re: Validate Year [message #155895 is a reply to message #155892] Thu, 19 January 2006 09:39 Go to previous messageGo to next message
JSI2001
Messages: 1016
Registered: March 2005
Location: Scotland
Senior Member
If it's a form, why not create a 3 comboboxes (pull down menus) with valid days, months and years, then create a date from the choices made.

Jim
Re: Validate Year [message #155896 is a reply to message #155811] Thu, 19 January 2006 09:50 Go to previous messageGo to next message
Duane
Messages: 588
Registered: December 2002
Senior Member
I think I will try something with the RR format. Pull down menus would be ok but I've already designed the form and created the javascript for the date format and calendar. Anyway, the faculty like to keep things simple and easy to use.
  • Attachment: calendar.gif
    (Size: 11.07KB, Downloaded 502 times)
Re: Validate Year [message #155898 is a reply to message #155811] Thu, 19 January 2006 09:55 Go to previous messageGo to next message
Duane
Messages: 588
Registered: December 2002
Senior Member
Any of you know how this is done? Point me in the right direction to accomplish this?

http://www.orafaq.com/forum/t/57768/49537/
Re: Validate Year [message #155929 is a reply to message #155896] Thu, 19 January 2006 13:26 Go to previous messageGo to next message
William Robertson
Messages: 1643
Registered: August 2003
Location: London, UK
Senior Member
Perhaps you could do some basic validation in JavaScript?

Would 1999 be invalid then? Perhaps your rule could be that the date entered should be within, say, 50 years of the current date.
Re: Validate Year [message #155934 is a reply to message #155929] Thu, 19 January 2006 13:40 Go to previous messageGo to next message
d.fowler
Messages: 21
Registered: January 2006
Location: Missouri
Junior Member

Oracle RR format handles y2k issues -50 +50 years using two digit format.

Min/max dates for application could be handled with a calender 'dimension' table which may have other useful attributes depending on the app. day/week/ weekend day flag , Holidays....

Depending on date requirements of the app.
Re: Validate Year [message #155936 is a reply to message #155929] Thu, 19 January 2006 14:38 Go to previous message
Duane
Messages: 588
Registered: December 2002
Senior Member
A year of 1999 would be invalid. I'll see what I can come up with. These are all good ideas and I do appreciate the help.
Previous Topic: Materialized View not Refreshing
Next Topic: The Difference between the Procedure and function.
Goto Forum:
  


Current Time: Thu Apr 09 22:18:54 CDT 2026