Re: How to treat optional dates?
>Are you sure? Isn't it m-d-y? Yes. Here's the code (getOrderDate returns a java.util.Date) : If row.orderDate is 01-01-0001, blanks are displayed. If row.orderDate is 16-09-2004, '2004-09-16' is displayed. (we do d/m/y in New Zealand). >> Since the posting I made a happy discovery though. If I save an optional >> date with the value '01-01-0001' (d-m-y), it appears as blank when >> displayed - just what I was after. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to treat optional dates?
On Thu, 2004-09-16 at 19:28, [EMAIL PROTECTED] wrote: > Since the posting I made a happy discovery though. If I save an optional > date with the value '01-01-0001' (d-m-y), it appears as blank when > displayed - just what I was after. Are you sure? Isn't it m-d-y? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to treat optional dates?
Treating them to a nice dinner and a romantic movie usually works ;-) HawHaw - I guess it depends on HOW optional! >Any reason you cant model them as null? The date's already defined as 'not null' on the data-base and I wanted to avoid touching it. Wouldn't null dates appear as 'null' if you attempted to display them anyway? (ie I'd still be stuck with the 'check the date before displaying it' overhead). Since the posting I made a happy discovery though. If I save an optional date with the value '01-01-0001' (d-m-y), it appears as blank when displayed - just what I was after. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to treat optional dates?
Treating them to a nice dinner and a romantic movie usually works ;-) Any reason you cant model them as null? At any rate, your UI should have them blank when they arent entered so as to avoid confusing the users. If you must store them as 1970 internally then I guess like you say, you will need to compare in the action when you prepopulate the form. [EMAIL PROTECTED] wrote: Hi all, I'm curious as to the best way to treat dates in a struts form when entry of the date is optional. Currently I'm storing un-entered optional dates as 1/1/1970. When I come to display an optional date field on a form, I need to decide whether to display a formatted date or a blank (by comparing the date to 1/1/1970). Surely there's a better way? Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to treat optional dates?
> Currently I'm storing un-entered optional dates as 1/1/1970. > When I come to display an optional date field on a form, I > need to decide > whether to display a formatted date or a blank (by comparing > the date to > 1/1/1970). > Surely there's a better way? What's wrong with storing null for an un-entered value? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to treat optional dates?
Hi all, I'm curious as to the best way to treat dates in a struts form when entry of the date is optional. Currently I'm storing un-entered optional dates as 1/1/1970. When I come to display an optional date field on a form, I need to decide whether to display a formatted date or a blank (by comparing the date to 1/1/1970). Surely there's a better way? Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]