Pigdogmonster
asked on
Simple If
This is causing me a real pain and I cannot figure out why this is not working!!
simple if Statement:-
<% if (varDelTime==("00:00:00") ) {%> N/A <%ELSE%><%=varDelTime%><%} %>
Basically if varDelTime has no delivery time i.e. 00:00:00 show n/a in the table
The datatype in the SQL table for del time is a varchar 8.
I tried converting varDelTime to an int but it had a problem with the :
simple if Statement:-
<% if (varDelTime==("00:00:00") ) {%> N/A <%ELSE%><%=varDelTime%><%}
Basically if varDelTime has no delivery time i.e. 00:00:00 show n/a in the table
The datatype in the SQL table for del time is a varchar 8.
I tried converting varDelTime to an int but it had a problem with the :
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:)
the easiest way would be to:
out.println(varDelTime).su bstring(0, 5);
the easiest way would be to:
out.println(varDelTime).su
argh, that would be
out.println(varDelTime.sub string(0, 5));
out.println(varDelTime.sub
ASKER
cool - for future ref:- what does the 0, 5 denote?
A String is zero based, which means that the index of the first character is 0,
so substring(0, 5) means: start at position 0 (first position, which is included in the substring) and end at position 5 (which is not included in the substring).
so index
0 = 0
1 = 9
2 = :
3 = 0
4 = 0
Another way to look at it is, start at position 0 and take 5 characters.
/Nick
09:00:00
so substring(0, 5) means: start at position 0 (first position, which is included in the substring) and end at position 5 (which is not included in the substring).
so index
0 = 0
1 = 9
2 = :
3 = 0
4 = 0
Another way to look at it is, start at position 0 and take 5 characters.
/Nick
09:00:00
oops, ignore the last 09:00:00 :)
ASKER
thats great thanks Nick!
no problem :)
ASKER
I need to readjust my brain - its because I have been working on ASP for the last 2 weeks!
just one quick thing on this - Do you know how I would display the time without the seconds?
i.e. at the moment it shows the time like this 09:00:00
I just want it to show: 09:00