How convert Date Between Hour 00~07AM?

  • Thread starter Thread starter ldiaz
  • Start date Start date
L

ldiaz

Hello, I have a query where the completition is like 3/4/10 6:51AM,
the second shift is working from 7:00PM~7:00AM.
So I need to get a day before, in some case where the time is 00:00Am~7:00AM,
please help me on that,

Completed_Date ShiftData
3/4/10 6:51 PM 3/4/2010 OK
3/4/10 6:51 AM 3/3/2010 Need a day before
3/5/10 12:51 AM 3/4/2010 Need a day before


Thanks
LD
 
IIf(TimeValue([Completed_Date]) < #07:00:00#, DateAdd("d", -1,
DateValue([Completed_Date]), DateValue([Completed_Date]))
 
Hello, I have a query where the completition is like 3/4/10 6:51AM,
the second shift is working from 7:00PM~7:00AM.
So I need to get a day before, in some case where the time is 00:00Am~7:00AM,
please help me on that,

Completed_Date ShiftData
3/4/10 6:51 PM 3/4/2010 OK
3/4/10 6:51 AM 3/3/2010 Need a day before
3/5/10 12:51 AM 3/4/2010 Need a day before


Thanks
LD

DateValue(DateAdd("h", -7, [Completed_Date]))

should do it for you
 
Great,
that's work perfectly..


Thanks
--
Lorenzo Díaz
Cad Technician


John W. Vinson said:
Hello, I have a query where the completition is like 3/4/10 6:51AM,
the second shift is working from 7:00PM~7:00AM.
So I need to get a day before, in some case where the time is 00:00Am~7:00AM,
please help me on that,

Completed_Date ShiftData
3/4/10 6:51 PM 3/4/2010 OK
3/4/10 6:51 AM 3/3/2010 Need a day before
3/5/10 12:51 AM 3/4/2010 Need a day before


Thanks
LD

DateValue(DateAdd("h", -7, [Completed_Date]))

should do it for you

--

John W. Vinson [MVP]

.
 
Back
Top