PC Review


Reply
Thread Tools Rate Thread

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

 
 
Guest
Posts: n/a
 
      2nd Mar 2004
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


 
Reply With Quote
 
 
 
 
DraguVaso
Guest
Posts: n/a
 
      2nd Mar 2004
use this function:
DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
CDate(endTimeTextBox.Text))


<(E-Mail Removed)> wrote in message news:c21kpt$1nvt1r$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      2nd Mar 2004
thx!

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

regards,


gicio




"DraguVaso" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> use this function:
> DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
> CDate(endTimeTextBox.Text))
>
>
> <(E-Mail Removed)> wrote in message news:c21kpt$1nvt1r$(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
DraguVaso
Guest
Posts: n/a
 
      2nd Mar 2004
microsoft.VisualBasic.DateDiff

Although I didn't need to set it in my project?


<(E-Mail Removed)> wrote in message news:c21m3c$1ocdnj$(E-Mail Removed)...
> thx!
>
> but I can't find any DateDiff function in the .NET framework.
> from wich namespace is DateDiff ???
>
> regards,
>
>
> gicio
>
>
>
>
> "DraguVaso" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > use this function:
> > DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
> > CDate(endTimeTextBox.Text))
> >
> >
> > <(E-Mail Removed)> wrote in message

news:c21kpt$1nvt1r$(E-Mail Removed)...
> > > 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
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Peter Strĝiman
Guest
Posts: n/a
 
      2nd Mar 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> microsoft.VisualBasic.DateDiff
>
> Although I didn't need to set it in my project?
>
>
> <(E-Mail Removed)> wrote in message news:c21m3c$1ocdnj$(E-Mail Removed)...
> > thx!
> >
> > but I can't find any DateDiff function in the .NET framework.
> > from wich namespace is DateDiff ???
> >
> > regards,
> >
> >
> > gicio
> >
> >
> >
> >
> > "DraguVaso" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > use this function:
> > > DateDiff(DateInterval.Minute, CDate(startTimeTextBox.Text ),
> > > CDate(endTimeTextBox.Text))
> > >
> > >
> > > <(E-Mail Removed)> wrote in message

> news:c21kpt$1nvt1r$(E-Mail Removed)...
> > > > 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
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
Re: Best Way To Convert String to DateTime Tom Porterfield Microsoft Dot NET 1 16th Apr 2004 09:46 PM
Convert DateTime to string? Tony Microsoft C# .NET 3 25th Mar 2004 05:49 AM
Convert string to DateTime and compare with another???? Microsoft Dot NET Framework 4 2nd Mar 2004 10:20 AM
Convert string to DateTime and compare with another???? Microsoft Dot NET 4 2nd Mar 2004 10:20 AM
Convert string to DateTime and compare with another???? Microsoft C# .NET 5 2nd Mar 2004 10:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 AM.