By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Presenting a Blank DateTime to User / n-Tier

P: n/a
Hi,

I have a business object that exposes a DateTime object to my presentation layer. Usually this is filled with a valid date, but sometimes it is empty (and stored as 1/1/1900 as it is a SmallDateTime in SQL Server). I'm unsure how best to present this to the user, I want no date to appear if it is blank "1/1/1900", but if it is a valid date, show it.

I guess I'm a little confused as to which layer should do this, my first hunch is the presentation layer, since this deals with what the user sees, but then when I think about it, to do this correctly, the presentation layer would have to account for the 1/1/1900 problem, which seems like something the business layer should have to do.

Is there any way I can store a value in a DateTime object, so when I use a ToString method, it returns as "", that would really fix it! Or any other suggestions I might try?

Thanks,
--Michael
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Sorry, don't have an answer. Just the same question

I want to do the same thing, except inside a datagrid. I know you can change
the sql select string to accomplish this, but my data table has many, many
dates, and the sql select string will be huge.

Is there any way to use the DataGridTextBoxColumn.Format function to
accomplish showing a blank date in the datagrid?

"Raterus" wrote:
Hi,

I have a business object that exposes a DateTime object to my presentation layer. Usually this is filled with a valid date, but sometimes it is empty (and stored as 1/1/1900 as it is a SmallDateTime in SQL Server). I'm unsure how best to present this to the user, I want no date to appear if it is blank "1/1/1900", but if it is a valid date, show it.

I guess I'm a little confused as to which layer should do this, my first hunch is the presentation layer, since this deals with what the user sees, but then when I think about it, to do this correctly, the presentation layer would have to account for the 1/1/1900 problem, which seems like something the business layer should have to do.

Is there any way I can store a value in a DateTime object, so when I use a ToString method, it returns as "", that would really fix it! Or any other suggestions I might try?

Thanks,
--Michael

Nov 21 '05 #2

P: n/a
I found the answer, if you are still looking.. email me..

"Raterus" wrote:
Hi,

I have a business object that exposes a DateTime object to my presentation layer. Usually this is filled with a valid date, but sometimes it is empty (and stored as 1/1/1900 as it is a SmallDateTime in SQL Server). I'm unsure how best to present this to the user, I want no date to appear if it is blank "1/1/1900", but if it is a valid date, show it.

I guess I'm a little confused as to which layer should do this, my first hunch is the presentation layer, since this deals with what the user sees, but then when I think about it, to do this correctly, the presentation layer would have to account for the 1/1/1900 problem, which seems like something the business layer should have to do.

Is there any way I can store a value in a DateTime object, so when I use a ToString method, it returns as "", that would really fix it! Or any other suggestions I might try?

Thanks,
--Michael

Nov 21 '05 #3

P: n/a
Hi Mathew, (or Micheal)

We are facing the same problem -- how to show a blank date to the user .
Ours is an n'tier application, In our db we store the date as null, but we
are not able to set the value of a date attribute to null..

If you do have a resolution, please respond . We have the isssue in our form
fields.

thanks a lot

Anand

"Mathew Michuta" wrote:
I found the answer, if you are still looking.. email me..

"Raterus" wrote:
Hi,

I have a business object that exposes a DateTime object to my presentation layer. Usually this is filled with a valid date, but sometimes it is empty (and stored as 1/1/1900 as it is a SmallDateTime in SQL Server). I'm unsure how best to present this to the user, I want no date to appear if it is blank "1/1/1900", but if it is a valid date, show it.

I guess I'm a little confused as to which layer should do this, my first hunch is the presentation layer, since this deals with what the user sees, but then when I think about it, to do this correctly, the presentation layer would have to account for the 1/1/1900 problem, which seems like something the business layer should have to do.

Is there any way I can store a value in a DateTime object, so when I use a ToString method, it returns as "", that would really fix it! Or any other suggestions I might try?

Thanks,
--Michael

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.