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!

Military time in formulas

Status
Not open for further replies.

harrietohs

IS-IT--Management
Apr 26, 2002
99
CA
Crystal 8.5

I need to divide a report into 3 military time segments:

08:00:01 to 16:00:00 (8 am to 4 pm shift)

16:00:01 to 24:00:00 (4 pm to midnight shift)

24:00:01 to 08:00:00 (midnight to 8 am shift)


Crystal does not allow me to enter anything past hour 23. Can I do this split on Crystal?

Harriet

 
You could use a formula like:

if {table.time} in time(08,00,01) to time(16,00,00) then
"8am to 4pm shift" else
if {table.time} in time(16,00,01) to time(23,59,59) or
{table.time} = time(00,00,00) then
"4pm to midnight shift" else
if {table.time} in time(00,00,01) to time(08,00,00) then
"Midnight to 8am shift"

Of course the complication comes in when you try to combine this with dates, since I believe time(00,00,00) belongs to the next day.

-LB
 
Aha, so I use 00,00,00 as midnight (not 24, 00, 00).

Your suggested formula did the trick,


Thanks!

Harriet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top