Basic Date question

  • Thread starter Thread starter dgk
  • Start date Start date
D

dgk

How do folks handle a situation where a Date that is a column in a
table isn't known for a particular row? Do we just leave it
uninitialized and have it show up in reports as 1/1/0001or something?
 
dgk said:
How do folks handle a situation where a Date that is a column in a
table isn't known for a particular row? Do we just leave it
uninitialized and have it show up in reports as 1/1/0001or something?

Either use 'Nullable(Of Date)' as column type in .NET 2.0 or 'SqlDateTime',
which is nullable too.
 
This sounds to me a question of preference. Leaving it uninitialized is
quite a good option. Since you know what the date is going to be you can
always make sure it's uninitialized.

You might also considering storing date in the numerical date format. This
way

20060110... The first four characters are year, then month, then day. It's a
perfectly logical way of storing a date and I use it quite often in my own
applications.

Cheers!
Cyril
 
This sounds to me a question of preference. Leaving it uninitialized is
quite a good option. Since you know what the date is going to be you can
always make sure it's uninitialized.

You might also considering storing date in the numerical date format. This
way

20060110... The first four characters are year, then month, then day. It's a
perfectly logical way of storing a date and I use it quite often in my own
applications.

Cheers!
Cyril
I thought about that but we're going to use Crystal Reports and SQL
Reporting Services and those aren't going to like that format.
 
Either use 'Nullable(Of Date)' as column type in .NET 2.0 or 'SqlDateTime',
which is nullable too.

The database is actually Cache (Intersystems) so I'm not sure how that
would translate. I'll find out.
 
dgk,

A dateTime that is empty in a datatime field in a datarow = DBNull.Value
A dateTime field in a normal Net datatime field that is not initialized =
Nothing,

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top