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

assign shift based on timestamp

Status
Not open for further replies.

4656rp

Technical User
Feb 25, 2003
20
US
Hello all,

I thought I had it, but apparently not. I'm trying to determine a shift 1 (day 0700-1900) or 2 (night 1901-0659) from a timestamp. Here's what I've done so far, which sometimes works (probably a coincidence) and sometimes doesn't:

UPDATE [Copydata] SET [Copydata].Shift_time = TimeValue(Right$([recdate],Len([recdate])-InStr(1,[recdate],' '))), [Copydata].Shift = IIf([shift_time] Between 0700 And 1900,'1','2')
WHERE ((([Copydata].Revudate) Between #4/1/2005# And #4/30/2005#));

What do you think? Your advice is always appreciated.

Thank you,

me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top