473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

DateTime, but why no Date class?

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
Jun 15 '06 #1
10 3590
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

Jun 15 '06 #2
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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...
Jun 15 '06 #3

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:Ow**************@TK2MSFTNGP05.phx.gbl...
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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
Jun 15 '06 #4
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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
Jun 15 '06 #5
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
Jun 15 '06 #6

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP02.phx.gbl...
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
Jun 15 '06 #7
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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...
Jun 15 '06 #8

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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
Jun 15 '06 #9
Mark Rae wrote:
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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

Jun 15 '06 #10
Mantorok,
I understand your frustration. Mark's link to the other solution I thought
was excellent. I've worked with .NET for 5+ years now, and have never felt
the need to have a "Date" class, since you can always wrap it or simply get
out what you need and not have to worry about the time component.
Cheers,
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mantorok" wrote:

"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"Mantorok" <ma******@mantorok.com> wrote in message
news:e6**********@newsfeed.th.ifl.net...
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

Jun 15 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max M | last post by:
# -*- coding: latin-1 -*- """ I am currently using the datetime package, but I find that the design is oddly asymmetric. I would like to know why. Or perhaps I have misunderstood how it...
6
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
5
by: ns21 | last post by:
Our application is windows desktop application. We are using VS.Net 2003, C#, Framework 1.1, SQL 2000. We use webservices to add/update/select objects. We are using XML Serialization. Following is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.