PC Review


Reply
Thread Tools Rate Thread

DateTime, but why no Date class?

 
 
Mantorok
Guest
Posts: n/a
 
      15th Jun 2006
Hi all

I've never really been a fan of always having to use a DateTime type when
9/10 times I only want to store a Date.

The main problem I've got now is that I have some user controls and I want
to determine whether the DateTime value I have should be displaying the
date-only or both date and time.

I take it there is no way on this earth that it can be determined what the
intentions are of a DateTime instance?

Thanks
Kev


 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      15th Jun 2006
Correct.

As the DateTime value always has a time, there is no telling if it was
created with the specific time 00:00 or without a time so that the
default time 00:00 was used.


Mantorok wrote:
> Hi all
>
> I've never really been a fan of always having to use a DateTime type when
> 9/10 times I only want to store a Date.
>
> The main problem I've got now is that I have some user controls and I want
> to determine whether the DateTime value I have should be displaying the
> date-only or both date and time.
>
> I take it there is no way on this earth that it can be determined what the
> intentions are of a DateTime instance?
>
> Thanks
> Kev
>

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      15th Jun 2006
"Mantorok" <(E-Mail Removed)> wrote in message
news:e6rfuo$mf2$(E-Mail Removed)...

> I take it there is no way on this earth that it can be determined what the
> intentions are of a DateTime instance?


http://www.msnewsgroups.net/group/mi...topic6617.aspx

One of the great things about the Framework is that, if you don't like
something straight out of the box, just modify it till it fits, or extend
it, or create something else entirely and use that...


 
Reply With Quote
 
Mantorok
Guest
Posts: n/a
 
      15th Jun 2006

"Mark Rae" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Mantorok" <(E-Mail Removed)> wrote in message
> news:e6rfuo$mf2$(E-Mail Removed)...
>
>> I take it there is no way on this earth that it can be determined what
>> the intentions are of a DateTime instance?

>
> http://www.msnewsgroups.net/group/mi...topic6617.aspx
>
> One of the great things about the Framework is that, if you don't like
> something straight out of the box, just modify it till it fits, or extend
> it, or create something else entirely and use that...


Yeah I'll have to do that if there is no way it can be done with the
existing class, this is what gets me about the Framework, on one side you
have strokes of genius, on the other you may have the most simplest problem
overlooked.

Unless of course there was a very good reason "not" to have a System.Date
class.

Kev


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      15th Jun 2006
"Mantorok" <(E-Mail Removed)> wrote in message
news:e6rj5d$o4f$(E-Mail Removed)...

>> One of the great things about the Framework is that, if you don't like
>> something straight out of the box, just modify it till it fits, or extend
>> it, or create something else entirely and use that...

>
> Yeah I'll have to do that if there is no way it can be done with the
> existing class, this is what gets me about the Framework, on one side you
> have strokes of genius, on the other you may have the most simplest
> problem overlooked.


I guess it's a trade-off between feature richness and feature bloat...

Somebody asked recently why there's no built-in method to convert Imperial
to Metric, Fahrenheit to Celsius etc...

> Unless of course there was a very good reason "not" to have a System.Date
> class.


That I can't answer


 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      15th Jun 2006
Hi,

> Yeah I'll have to do that if there is no way it can be done with the
> existing class, this is what gets me about the Framework, on one side you
> have strokes of genius, on the other you may have the most simplest
> problem overlooked.


It's impossible to accomodate ALL the possible requirements of all the
programmers. The important thing is that you can extend AND modify the
classes at your convenience.

> Unless of course there was a very good reason "not" to have a System.Date
> class.


Maybe cause it's not that important? I've been programming several years now
in .net and I have never ever needed such a distinction.


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


 
Reply With Quote
 
Mantorok
Guest
Posts: n/a
 
      15th Jun 2006

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%(E-Mail Removed)...
> Hi,
>
>> Yeah I'll have to do that if there is no way it can be done with the
>> existing class, this is what gets me about the Framework, on one side you
>> have strokes of genius, on the other you may have the most simplest
>> problem overlooked.

>
> It's impossible to accomodate ALL the possible requirements of all the
> programmers. The important thing is that you can extend AND modify the
> classes at your convenience.


I can modify the framework classes? How? Or did you mean modify the
descendant classes?

>> Unless of course there was a very good reason "not" to have a System.Date
>> class.

>
> Maybe cause it's not that important? I've been programming several years
> now in .net and I have never ever needed such a distinction.


What do you display in your UI if you query a DateTime value? Do you convert
it to a short format if you need to or do you leave it displaying the
trailing zeros?

Kev


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      15th Jun 2006
"Mantorok" <(E-Mail Removed)> wrote in message
news:e6rmit$q1t$(E-Mail Removed)...

> I can modify the framework classes? How?


Inasmuch as you can derive new classes from them and override the
functionality...

> Do you convert it to a short format if you need to


Yes - this is just presentation... Same was as I choose how many decimal
places to display in numeric values, etc...


 
Reply With Quote
 
Mantorok
Guest
Posts: n/a
 
      15th Jun 2006

"Mark Rae" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "Mantorok" <(E-Mail Removed)> wrote in message
> news:e6rmit$q1t$(E-Mail Removed)...
>
>> I can modify the framework classes? How?

>
> Inasmuch as you can derive new classes from them and override the
> functionality...


Except for sealed classes of course, which is what DateTime is, suppose I'll
have to create a wrapper for it.

>> Do you convert it to a short format if you need to

>
> Yes - this is just presentation... Same was as I choose how many decimal
> places to display in numeric values, etc...


Yeah I suppose it's the same when you thnk about it.

Kev


 
Reply With Quote
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      15th Jun 2006
Mark Rae wrote:
> "Mantorok" <(E-Mail Removed)> wrote in message
> news:e6rj5d$o4f$(E-Mail Removed)...
>
>>> One of the great things about the Framework is that, if you don't like
>>> something straight out of the box, just modify it till it fits, or extend
>>> it, or create something else entirely and use that...

>> Yeah I'll have to do that if there is no way it can be done with the
>> existing class, this is what gets me about the Framework, on one side you
>> have strokes of genius, on the other you may have the most simplest
>> problem overlooked.

>
> I guess it's a trade-off between feature richness and feature bloat...
>
> Somebody asked recently why there's no built-in method to convert Imperial
> to Metric, Fahrenheit to Celsius etc...


Let me guess...

Someone doing a beginners course in programming, and trying to avoid
learning anything?



>> Unless of course there was a very good reason "not" to have a System.Date
>> class.

>
> That I can't answer
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
How to convert a date string to datetime value with custom date format? ABC Microsoft C# .NET 1 29th Sep 2005 11:11 AM
DateTime problem: how to create datetime format hh:mm:ss AM/PM without the date mimi Microsoft C# .NET 1 6th Aug 2004 08:28 PM
Re: Date and DateTime class Herfried K. Wagner [MVP] Microsoft VB .NET 0 10th Mar 2004 04:59 PM
time_t to C# DateTime class Claire Microsoft Dot NET 1 3rd Dec 2003 01:18 AM
datetime class: setting day, month... Ante Perkovic Microsoft ASP .NET 7 2nd Jul 2003 12:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:55 AM.