Re: Determining whether a string is a date, time, or date and time
- From: "Nathan Sokalski" <njsokalski@xxxxxxxxxxx>
- Date: Wed, 26 Mar 2008 22:13:11 -0400
This would not work. The reason I need to know this information is so that I
know whether to include the date, time, or both when submitting the data to
a database. The reason your suggestion will not work is because a Date
object ALWAYS has a date and time, even if the date is the default date or
the time is 0:00 or 12:00 or whatever. Therefore, looking at these parts of
the Date will tell me nothing about whether a date, time, or both were
included in the original String.
--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/
"Spam Catcher" <spamhoneypot@xxxxxxxxxx> wrote in message
news:Xns9A6DDD5D7857Ausenethoneypotrogers@xxxxxxxxxxxx
"Nathan Sokalski" <njsokalski@xxxxxxxxxxx> wrote in
news:O8ULZv5jIHA.4376@xxxxxxxxxxxxxxxxxxxx:
When determining whether a String can be converted to a DateTime, you
can use the IsDate() method. However, I would also like to know
whether the string is a date, a time, or both a date and a time. Is
there any simple way to do this without using manual pattern matching?
Thanks.
Perhaps you can use the Convert.ToDate() function? Once you convert it to
a
date, you can check the .Date and .Time properties to determine the
original values?
--
spamhoneypot@xxxxxxxxxx (Do not e-mail)
.
- Follow-Ups:
- Re: Determining whether a string is a date, time, or date and time
- From: Patrice
- Re: Determining whether a string is a date, time, or date and time
- From: Stephany Young
- Re: Determining whether a string is a date, time, or date and time
- References:
- Determining whether a string is a date, time, or date and time
- From: Nathan Sokalski
- Re: Determining whether a string is a date, time, or date and time
- From: Spam Catcher
- Determining whether a string is a date, time, or date and time
- Prev by Date: Re: Determining whether a string is a date, time, or date and time
- Next by Date: Re: Close a form by pressing esc, how to do it without having a button
- Previous by thread: Re: Determining whether a string is a date, time, or date and time
- Next by thread: Re: Determining whether a string is a date, time, or date and time
- Index(es):
Relevant Pages
|