Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP comparing time (w. AM/PM)

Status
Not open for further replies.

Pulsorock

Programmer
Sep 25, 2002
1
PR
Hello,
I need to compare the actual time on my server to the value I'm receiving on a database.
For example, let's say the actual time is 1:45 PM and the value in the database is 11:52 AM. I need to compare that if the actual time is after the one on the database, it returns a true value, if not returns a false value.
I tried this ASP code, bit it didn't worked, any ideas?

Code:
<%
time_from_db = &quot;11:52 AM&quot;
if time_from_db > FormatDateTime(Now,3) then %>

<input type=&quot;radio&quot; name=&quot;tanda_hora&quot; value=&quot;<%= time_from_db %>&quot;><%= time_from_db %>

<%else%>

<strike><%= time_from_db&quot;) %></strike>

<% end if %>
 
try comparing both after formating them. The DB may be bringing it in in a different format of even if it is a string value then it will not calc right.
example:
dim fstDate, scnDate
fstDate = FormatDateTime(Time,3)
scnDate = FormatDateTime(&quot;1:00:00 PM&quot;,3)
alert fstDate & &quot; &quot; & scnDate
if scnDate > fstDate then
alert &quot;OK!&quot;
end if A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top