-
Setting a specific time
I`m developing a library catalog in SQL server with a Cold Fusion front end, and I`m having some trouble with setting due dates for books when they get checked out. Most items in the library are due in a week, a month, etc., so it is easy to calculate the due date. However, we have a number of items that are due at the end of the working day.
So, I need to find a way to calculate "the next 5 PM", no matter what time of day it is, and store it in a datetime field? Any ideas?
Any help would be appreciated.
Thanks,
-Elizabeth S. Thomas
Technical Librarian
MAJIQ, Inc.
ELizabeth_Thomas@majiq.com
-
Setting a specific time (reply)
You could check the current time (getdate()) and if the hour is past 5:00 p.m. (DATEPART(hour,getdate()) > 17) then add one to the date, if not then use the date and add 5:00 p.m. to the date. If the day of the week is Friday (assuming that is the last working day of the week) you could add 3 days and tack on 5:00 p.m. at the end of the date. You can use DATENAME(weekday, getdate()) or DATEPART(weekday,getdate()) to get the day of the week.
On 8/13/98 1:39:13 PM, Elizabeth Thomas wrote:
> I`m developing a library catalog in SQL server with a Cold Fusion front
> end, and I`m having some trouble with setting due dates for books when they
> get checked out. Most items in the library are due in a week, a month,
> etc., so it is easy to calculate the due date. However, we have a number of
> items that are due at the end of the working day.
So, I need to find a
> way to calculate "the next 5 PM", no matter what time of day it is, and
> store it in a datetime field? Any ideas?
Any help would be
> appreciated.
Thanks,
-Elizabeth S. Thomas
Technical Librarian
MAJIQ,
> Inc.
ELizabeth_Thomas@majiq.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|