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

Time, Date expression needed

Status
Not open for further replies.

millrat

Technical User
Dec 23, 2003
98
US
Hi all,
My report is for permits issued each shift.
Day shift 06:00-18:00 and Night shift 18:00-06:00
My report has 2 text boxes, textbox1 has the value Now() for date/time the permit is issued and textbox2 is for date/time of expiry (the end of shift). I would like to create an expression which puts a date/time value in textbox2, either 18:00 or 06:00, dependent on the value of Now(). Keep in mind issue times 18:00-00:00 need expiry time of 06:00 the NEXT day.
All help appreciated, thanks
millrat
 
Hi

Presumably theer is some variation in time of issue ie not all passes are issues at exactly 06:00 (say).

Thus we would need to know the rules as to how you decide the start time of the pass (eg if pass isssued at (say) 05:57, we can say 06:00, but what if pass issued at say 03:00 is it an 'early' 06:00 or a 'late' 18:00 ?

Once you have cleared up that, the function you need to look at is DateAdd(), despite its name it can in fact add time units (eg hours) to a given date time field, so you expiry time would be

expiry = DateAdd("h",8,StartTime)

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top