c# - For check variable, which condition will given? -


i have 2 textboxes. 1 clock in time , 1 clock out. times put in format:

hours:minutes 

let's have clocked in @ 22:00 , clocked out @ 2:00 pm.

how in c#.

so, basically, how give condition check clocked in @ 22:00 am? want error here.if user give clocked in time @ 22:00 am.

string starttime = "22:00 am";  string endtime =2:00 pm;  datetime t1 = convert.todatetime(starttime); //get error:(string not recognized valid datetime.)<br> datetime t2 = convert.todatetime(endtime);  

what gathering want throw error when have out of limit of 01:00 24:00 or 01:00am 12:00pm first thing decide on format want use. depending on project working on, if winform use masked editor , set format want (0:00am/pm or 00:00) , add errorprovider, if wpf project have code below;

<textbox text="{binding time,stringformat=hh\\:mm}"/> 

hope helps:)


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -