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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for time.

Status
Not open for further replies.

nalbiso

Programmer
Aug 31, 2000
71
US
Hello.

I have the following:

<input type=&quot;text&quot; name=&quot;startbacktime&quot;> In this box, the visitor puts in both the date in format mm/dd/yy and the time in format 00:00 am/pm. So if the date and time is January 1, 2002 at 1:00 pm, the visitor would enter 01/01/02 1:00 pm.

I also have a checkbox called PRIME

What I am looking for is a code that would check only the time portion entered in the startbacktime textbox and if it is between 7:00 am - 9:00 am or 2:00 pm - 4:00 pm to automatically check the PRIME checkbox.

Any help would be greatly appreciated.
 
you can use DateCompare() function; DateCompare() performs a full date/time comparison of two dates.

Returns:
-1 if date1 is less than date2
0 if date1 is equal to date2
1 if date1 is greater than date2

DatePart:
s Precise to the second
n Precise to the minute
h Precise to the hour
d Precise to the day
m Precise to the month
yyyy Precise to the year

Syntax: DateCompare(date1, date2 [, datePart])


for date1 you can in addition use CreateDateTime() to create date to compare against;

DateCompare(CreateDateTime(year, month, day, hour, minute, second), date2(userEntry), h (Precise to the hour)) Sylvano
dsylvano@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top