By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,723 Members | 834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,723 IT Pros & Developers. It's quick & easy.

Convert string to DateTime and compare with another????

P: n/a
I have two text boxes;

startTimeTextBox.Text = "08:00";
endTimeTextBox.Text = "15:00";

and now I will check if startTimeTextBox.Text starts
really before endTimeTextBox.Text

something like this:
bool timeIsOk = (startTimeTextBox.Text < endTimeTextBox.Text);
but how to do it real?

regards,

gicio
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
use this function:
DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
CDate(endTimeTextBox.Text))
<gi***@gmx.de> wrote in message news:c2*************@news.hansenet.net...
I have two text boxes;

startTimeTextBox.Text = "08:00";
endTimeTextBox.Text = "15:00";

and now I will check if startTimeTextBox.Text starts
really before endTimeTextBox.Text

something like this:
bool timeIsOk = (startTimeTextBox.Text < endTimeTextBox.Text);
but how to do it real?

regards,

gicio

Jul 21 '05 #2

P: n/a
thx!

but I can't find any DateDiff function in the .NET framework.
from wich namespace is DateDiff ???

regards,
gicio


"DraguVaso" <pi**********@hotmail.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
use this function:
DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
CDate(endTimeTextBox.Text))
<gi***@gmx.de> wrote in message news:c2*************@news.hansenet.net...
I have two text boxes;

startTimeTextBox.Text = "08:00";
endTimeTextBox.Text = "15:00";

and now I will check if startTimeTextBox.Text starts
really before endTimeTextBox.Text

something like this:
bool timeIsOk = (startTimeTextBox.Text < endTimeTextBox.Text);
but how to do it real?

regards,

gicio


Jul 21 '05 #3

P: n/a
microsoft.VisualBasic.DateDiff

Although I didn't need to set it in my project?
<gi***@gmx.de> wrote in message news:c2*************@news.hansenet.net...
thx!

but I can't find any DateDiff function in the .NET framework.
from wich namespace is DateDiff ???

regards,
gicio


"DraguVaso" <pi**********@hotmail.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
use this function:
DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
CDate(endTimeTextBox.Text))
<gi***@gmx.de> wrote in message news:c2*************@news.hansenet.net...
I have two text boxes;

startTimeTextBox.Text = "08:00";
endTimeTextBox.Text = "15:00";

and now I will check if startTimeTextBox.Text starts
really before endTimeTextBox.Text

something like this:
bool timeIsOk = (startTimeTextBox.Text < endTimeTextBox.Text);
but how to do it real?

regards,

gicio



Jul 21 '05 #4

P: n/a
Those functions are visual basic functions - and although you might be able
to use them from C#, a better way would be something like:

DateTime time1 = Convert.ToDateTime( startTimeTextBox.Text );
DateTime time2 = Convert.ToDateTime( endTimeTextBox.Text );

if ( time1 < time2 )

Note: I didn't consult the API when writing this - so check out the
functions yourself ( which I would recommend you do anyway to get familiar
with them ).

Pete

"DraguVaso" <pi**********@hotmail.com> wrote in message
news:OZ**************@TK2MSFTNGP09.phx.gbl...
microsoft.VisualBasic.DateDiff

Although I didn't need to set it in my project?
<gi***@gmx.de> wrote in message news:c2*************@news.hansenet.net...
thx!

but I can't find any DateDiff function in the .NET framework.
from wich namespace is DateDiff ???

regards,
gicio


"DraguVaso" <pi**********@hotmail.com> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...
use this function:
DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
CDate(endTimeTextBox.Text))
<gi***@gmx.de> wrote in message news:c2*************@news.hansenet.net... > I have two text boxes;
>
> startTimeTextBox.Text = "08:00";
> endTimeTextBox.Text = "15:00";
>
> and now I will check if startTimeTextBox.Text starts
> really before endTimeTextBox.Text
>
> something like this:
>
>
> bool timeIsOk = (startTimeTextBox.Text < endTimeTextBox.Text);
>
>
> but how to do it real?
>
>
>
> regards,
>
> gicio
>
>



Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.