D
Dave
What magic to I need to do to get the DATETIME.Today to only return
the DATE?!?
the DATE?!?
* Dave said:What magic to I need to do to get the DATETIME.Today to only return
the DATE?!?
* Peter Duniho said:Felix said:DateTime.Today contains no time, all time fields are set to zero. [...]
Saying DateTime.Today contains no time is like saying an int variable
holding the value 0 contains no integer.
* Peter Duniho said:Felix said:DateTime.Today contains no time, all time fields are set to zero. [...]Saying DateTime.Today contains no time is like saying an int variable
holding the value 0 contains no integer.
No it isn't. Of course you CAN interpret the time fields of
DateTime.Today as midnight, but looking at the MSDN, it says the fields
are "set to zero". So they are just meaningless, in terms of semantics.
--
Felix Palmen (Zirias) + [PGP] Felix Palmen <[email protected]>
web: http://palmen-it.de/ | http://palmen-it.de/pub.txt
my open source projects: | Fingerprint: ED9B 62D0 BE39 32F9 2488
http://palmen-it.de/?pg=pro + 5D0C 8177 9D80 5ECF F683
* Dave said:Ok....let me rephrase the question. How do I get the DateTime.Today
to return only the Date ie 8/9/2010? No zeros...no 12:00am
representation...JUST the date.
* Dave said:Ok....let me rephrase the question. How do I get the DateTime.Today
to return only the Date ie 8/9/2010? No zeros...no 12:00am
representation...JUST the date.
Again, are you talking about string conversions? If so, search the msdn
for date format strings. If not, the question isn't meaningful, because
the class DateTime HAS time fields.
--
Felix Palmen (Zirias) + [PGP] Felix Palmen <[email protected]>
web: http://palmen-it.de/ | http://palmen-it.de/pub.txt
my open source projects: | Fingerprint: ED9B 62D0 BE39 32F9 2488
http://palmen-it.de/?pg=pro + 5D0C 8177 9D80 5ECF F683
Felix said:* Peter Duniho said:Saying DateTime.Today contains no time is like saying an int variableFelix said:DateTime.Today contains no time, all time fields are set to zero. [...]
holding the value 0 contains no integer.
No it isn't. Of course you CAN interpret the time fields of
DateTime.Today as midnight, but looking at the MSDN, it says the fields
are "set to zero". So they are just meaningless, in terms of semantics.
Ok....let me rephrase the question. How do I get the DateTime.Today
to return only the Date ie 8/9/2010? No zeros...no 12:00am
representation...JUST the date.
* Harlan Messinger said:The System.DateTime semantics of 0 hours, 0 minutes, and 0 seconds is
midnight, whether they are set that way by you in your code or by the
Today property.
* Dave said:What isn't useful Felix is a reply telling an individual to go
search. You could give an example of what you're refering to. That
would be helpful to someone that isn't sure what they're looking for.
Depends wheter you're interested in the general sematics of the class or
in those of this static property. The property's semantics are limited
to the date fields (it says it returns the current day), so an
equally valid implementation would be
| get { return DateTime.Now; }
Of course, this would be a stupid implementation, but it wouldn't
violate the semantics of "Today".
The real benefit of the Today property is to provide an easy way to
compare two DateTimes without regard to the time.
* Peter Duniho said:Felix said:[...]
No it isn't. Of course you CAN interpret the time fields of
DateTime.Today as midnight, but looking at the MSDN, it says the fields
are "set to zero". So they are just meaningless, in terms of semantics.
You have just said (basically) "an int variable holding the value 0
contains no integer".
* Peter Duniho said:Felix said:* Peter Duniho said:Felix Palmen wrote:
[...]
No it isn't. Of course you CAN interpret the time fields of
DateTime.Today as midnight, but looking at the MSDN, it says the fields
are "set to zero". So they are just meaningless, in terms of semantics.
You have just said (basically) "an int variable holding the value 0
contains no integer".
No, that's not what I said but what you obviously read.
You are missing my point. That point is: your statement is logically
equivalent to the same statement made about an int variable, and is just
as incorrect.
* Peter Duniho said:You should care.
DateTime dt1 = DateTime.Now, dt2 = DateTime.Today;
TimeSpan ts = dt1 - dt2;