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

3rd shift time/date change

Status
Not open for further replies.
Jul 1, 2008
37
US
I am attempting to write a report where it tracks each individual’s operational punches by day. I have having a hard time writing this report for third shift. Third shift is 10:00 pm to 6:00 am. The problem I am having is two different dates are actually one day for 3rd shift. Is there a formula I can write that will change any punches after 9:00pm to the following day’s date and all punches before 9:00pm to be on the correct day’s date?

Thank you,
Angie
 
In Crystal 11.5, you could write something like
Code:
If Hour({Your.Date}) >= 22
then {Your.Date}+1
else {Your.Date}
Older versions of Crystal may not have Hour: if that applies to you, then use DatePart. The HELP function should give you its options.

DateAdd is the normal command for adjusting dates and times, but if you add one this is assumed to be one day.

You can also use ToText to format dates, maybe losing the time part.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Sorry, it's a little more complicated than that. What I have is version 9.0. I don't actually have a date/time field. What I have is seconds from January 1, 1990 (midnight). Below is the formula I have to use to create a date-time field. I call this formula, "Start Time"

(DateAdd ("s", {sfeventcds.end-time}, #1/1/1990#) )

Can I still use the formula above?

Thank you,
Angie
 
Try this, using your formula for {@StartTime}:

dateadd("h",2,{@StartTime})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top