Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Calendar Validation

Reply
Thread Tools

Calendar Validation

 
 
bort
Guest
Posts: n/a
 
      04-12-2004
Hi all

Is there a way to validate the information in a Calendar object? For
instance, if the values for April 31, 2004 were entered (at date that does
not exist), how could we determine whether it is valid or not?

tia,
bort


 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      04-12-2004
On Mon, 12 Apr 2004 16:35:06 GMT, "bort" <(E-Mail Removed)> wrote
or quoted :

>
>Is there a way to validate the information in a Calendar object? For
>instance, if the values for April 31, 2004 were entered (at date that does
>not exist), how could we determine whether it is valid or not?


BigDate.isValid is the easiest way. See
http://mindprod.com/products.html#BIGDATE. I wrote it before
GregorianCalendar existed.

Someone else could tell you how with Calendar.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
 
Michael Scovetta
Guest
Posts: n/a
 
      04-13-2004
try {
Calendar c = new GregorianCalendar();
c.setLenient(false);
c.set(Calendar.DATE, 44);
c.getTime();
} catch(IllegalArgumentException ex) {
// bad input
}

-Mike

"bort" <(E-Mail Removed)> wrote in message news:<_yzec.1552$(E-Mail Removed) e.rogers.com>...
> Hi all
>
> Is there a way to validate the information in a Calendar object? For
> instance, if the values for April 31, 2004 were entered (at date that does
> not exist), how could we determine whether it is valid or not?
>
> tia,
> bort

 
Reply With Quote
 
bort
Guest
Posts: n/a
 
      04-13-2004
Thanks Michael... worked like a charm!

"Michael Scovetta" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> try {
> Calendar c = new GregorianCalendar();
> c.setLenient(false);
> c.set(Calendar.DATE, 44);
> c.getTime();
> } catch(IllegalArgumentException ex) {
> // bad input
> }
>
> -Mike
>
> "bort" <(E-Mail Removed)> wrote in message

news:<_yzec.1552$(E-Mail Removed) e.rogers.com>...
> > Hi all
> >
> > Is there a way to validate the information in a Calendar object? For
> > instance, if the values for April 31, 2004 were entered (at date that

does
> > not exist), how could we determine whether it is valid or not?
> >
> > tia,
> > bort



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar GadGets does not show calendar iccsi Windows 64bit 4 08-14-2011 01:52 PM
How to Synchronise Hotmail Calendar with Standard Outlook Calendar using Outlook Connector ?? Synapse Syndrome Computer Support 0 12-02-2007 04:19 AM
Thunderbird Calendar with Exchange 2003 Calendar and Public FoldersCalendar jincmcse Firefox 1 09-03-2005 02:46 AM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net 3 06-23-2004 01:41 PM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net Web Controls 0 06-23-2004 12:06 PM



Advertisments