473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Time Function

Hello,

Can anyone think of a short piece of code which does he following:
-------------------------------------
if Current Time is LESS THAN 19:30 then Write: Open For Business

Else

Write: Sorry - Closed
-------------------------------------
and
-------------------------------------
if Current Time is Between 12:00 and 14:00 then Write: Away to Lunch
Else
Write: Open For Business
-------------------------------------

It's actually for a call centre app, just the above scenario is much easier
to explain. Any help appreciated!!!

Regards,

Gary.
Aug 15 '06 #1
6 1314
Badass wrote on 15 aug 2006 in microsoft.public.inetserver.asp.general:
Can anyone think of a short piece of code which does he following:
Certainly I can, I am thinking of it now.
Should it be under serverside asp? ASP
-------------------------------------
if Current Time is LESS THAN 19:30 then Write: Open For Business

Else

Write: Sorry - Closed
-------------------------------------
and
-------------------------------------
if Current Time is Between 12:00 and 14:00 then Write: Away to Lunch
Else
Write: Open For Business
-------------------------------------

It's actually for a call centre app, just the above scenario is much
easier to explain. Any help appreciated!!!
What have you done sofar yourself?

For help, we would have to no where you go wrong.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 15 '06 #2
Badass wrote:
Hello,

Can anyone think of a short piece of code which does he following:
-------------------------------------
if Current Time is LESS THAN 19:30 then Write: Open For Business

Else

Write: Sorry - Closed
-------------------------------------
and
-------------------------------------
if Current Time is Between 12:00 and 14:00 then Write: Away to Lunch
Else
Write: Open For Business
-------------------------------------

It's actually for a call centre app, just the above scenario is much
easier to explain. Any help appreciated!!!
This explanation is contradictory, but I think I understand what you mean.
If you wish to write code, you need to learn to clearly state your
requirements. Try it this way:

if time later than 19:30 write "Sorry - Closed"
if time between 12:00 and 14:00 then write "Away to Lunch"
otherwise, write "Open For Business"

Assuming you wish this done in vbscript, then this should do it for you:

<%
dim t
t=now() - date()
't now contains just the current time
if t #19:30# then
Response.Write "Sorry - Closed"
Elseif t >= #12:00# and t <= #14:00# then
Response.Write "Away to Lunch"
Else
Response.Write "Open For Business"
End if
%>

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 15 '06 #3
What have you done sofar yourself?
Not tried it yet, rather than spend 3 hours trying to work it out, I thought
I would check for some help here. I always eventually manage to get things
working on my own if I get no replies, but mostly people are happy to help.

Thanks for the reply.

G.
Aug 15 '06 #4
Assuming you wish this done in vbscript, then this should do it for you:
>
<%
dim t
t=now() - date()
't now contains just the current time
if t #19:30# then
Response.Write "Sorry - Closed"
Elseif t >= #12:00# and t <= #14:00# then
Response.Write "Away to Lunch"
Else
Response.Write "Open For Business"
End if
%>

Thanks for the reply, will give it a try :o)

G.
Aug 15 '06 #5
Dear lameass,
>but mostly people are happy to help.
So, apparently you don't understand the difference between "helping" and
"doing it for you"?

Bob Lehmann

"Badass" <ba****@spamspam.comwrote in message
news:qO*****************@text.news.blueyonder.co.u k...
What have you done sofar yourself?


Not tried it yet, rather than spend 3 hours trying to work it out, I
thought
I would check for some help here. I always eventually manage to get
things
working on my own if I get no replies, but mostly people are happy to
help.
>
Thanks for the reply.

G.


Aug 16 '06 #6

"Bob Lehmann" <no****@dontbotherme.zzzwrote in message
news:O3**************@TK2MSFTNGP04.phx.gbl...
Dear lameass,
>>but mostly people are happy to help.
So, apparently you don't understand the difference between "helping" and
"doing it for you"?

Bob Lehmann


Well if someone were to do it for me, it would be a tremendious help!!!
Either way, its helping...

Badass (Apparently Lame).
Aug 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
17
by: newbiecpp | last post by:
I have hard time to understand run-time environment. Let assume that I have a program that has a simple variable alpha. When this variable is statically allocated, the compiler can use the...
17
by: Razzel | last post by:
I created this as a test: #include <time.h> main(){ printf(X1: %s\n", putim()); printf(X2: %s\n", putim()); } putim() { time_t t; time(&t); return(ctime(&t));
5
by: Sinan Nalkaya | last post by:
hello, i need a function like that, wait 5 seconds: (during wait) do the function but function waits for keyboard input so if you dont enter any it waits forever. i tried time.sleep() but when...
3
by: cj | last post by:
If I want to check to see if it's after "11:36 pm" what would I write? I'm sure it's easy but I'm getting tired of having to work with dates and times. Sometimes I just want time or date. And...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
1
by: nigelesquire | last post by:
I am in need of your assistance. I have a page with multiple unixtime stamps and I need to display them in readable time and date with the user's time zone. Below is the code. <!DOCTYPE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.