How convert Date Between Hour 00~07AM?

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
 
D

Douglas J. Steele

IIf(TimeValue([Completed_Date]) < #07:00:00#, DateAdd("d", -1,
DateValue([Completed_Date]), DateValue([Completed_Date]))
 
J

John W. Vinson

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
 
L

ldiaz

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]

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top