Time

1. Senior Member
Join Date
Dec 1969
Posts
2,880

## Time

Hi,<BR><BR>I was hoping how I can use Time() to tell a person whether the place is open or close e.g. If the time is later than 5.30 p.m then the office is closed.<BR><BR>Thanks

2. Member
Join Date
Dec 1969
Posts
81

## RE: Time

IF time() &#062; ctime(09;00) AND time() &#060; ctime(17:30) THEN<BR>ShopStatus = "open"<BR>ELSE<BR>ShopStatus = "closed"<BR>END IF<BR>

3. Senior Member
Join Date
Dec 1969
Posts
449

## ctime?

Didn&#039;t think ctime was valid in ASP.<BR><BR>to use the 9:00 to 5:30 range<BR>&#060;%<BR>rightnow = time()<BR>closetime = "05:30:00 PM" &#039;or "17:30:00"<BR>opentime = "09:00:00 AM"<BR><BR>if CDate(rightnow) &#062; CDate(opentime) AND CDate(rightnow) &#060; CDate(closetime) then<BR> Response.Write "open"<BR>Else<BR> Response.Write "closed"<BR>End If<BR>%&#062;

4. Member
Join Date
Dec 1969
Posts
81

## OK, OK cdate then!

Hmmm.. caught sleeping.<BR>Of course it should be cdate not ctime.

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## Even better...

IF time() &#062;= TimeSerial(9,0,0) AND time() &#060; TimeSerial(17,30,0) THEN<BR> ShopStatus = "open"<BR>ELSE<BR> ShopStatus = "closed"<BR>END IF<BR><BR>*************<BR><BR>If you use TimeSerial, it&#039;s much more efficient, since the result is *already* a Date/Time value and poor VBS doesn&#039;t have to convert an ugly string with CDate.<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•