7 Replies Latest reply: May 15, 2014 10:01 AM by Grant Perkins

# time date problem

Hi I am new to the forum. I have a time subtraction problem.

I am trying to subtract the arrival time from the discharge time to find out how long the process took[/U]. Here is an example of the data: arr date time 4/1/2008 7:15:00 PM and the discharge date time is 4/2/2008 12:16:00 AM. I have tried using the fields as they are here as well as military time and also just the time without the date. I am trying to automate the process as much as possible for a hospital. If I can get the process time with monarch I can always export to an excel spreadsheet to figure the median process time which is the ultimate goal. Your help would be greatly appreciated.

I looked through the forum and couldn't find any thread that helped (but I could have missed one)

Thanks your help it is greatly appreciated.

• ###### time date problem

Since you are using 9.01, make sure that your dates are formatted as Date/Time fields, then create a Numeric Formula, with the format as Time Span, then subtract one date/time from the other to get your mean time. That should accomplish what you need, unless I'm missing something.

• ###### time date problem

Almost, Nick. You missed the old "multiply by 86400" bit.

So your formula for the time span formatted numeric calculated field (say that ten times fast), is:

(End-Start)*86400

/code

Which, given the sample values will give you "05:01:00".

• ###### time date problem

[quote="Maxwell Smart"]Missed it by that much.[/quote]

Thanks for the assist!

• ###### time date problem

Nick and Data Kruncher - my heros;)

I had tried what you said before I posted Nick but thank you because it let me know I was on the right track. I too was missing the magic piece Data Kruncher thank you for making it fall into place.

• ###### time date problem

:eek:I found a problem with the time after exporting it to excel:

data example: discharge 4/272008 1:23:00pm - arrival 4/27/2008 1:05:00PM

the resulting time difference is 00:18:00 (using the formula (-[arr date time])*86400) but when the data is exported to excel the result changes to 1080.

Is there anyway to program the data so it exports into excel as it looks in monarch before the export? I still have to figure a way to show the median result of the time difference as well. I am trying to automate the process for nurses so they don't have to do anything but view the report. Thanks

• ###### time date problem

OK, you'll likely want to properly determine the actual minutes and seconds separately, rather than the representation time span gives you.

Build yourself some calculated numeric fields in addition to your Duration field, as follows:

Hours:

Int(Duration/3600)[/SIZE]

/code

Minutes:

Int((Duration-Hours*3600)/60)[/SIZE]

/code

Seconds:

Mod((Duration-Hours*3600),60)[/SIZE]

/code

Though it might be possible to determine your medians in a Monarch summary, you may want to determine those in Excel.

• ###### time date problem

Is there anyway to program the data so it exports into excel as it looks in monarch before the export? I still have to figure a way to show the median result of the time difference as well. I am trying to automate the process for nurses so they don't have to do anything but view the report. Thanks[/quote]

The Date difference calculation gives a result as a proportion of a day in seconds A value of 1.0 gives a full day. 1080/86400 gives 18 minutes.

An Excel field formatted as Time needs to be fed with 1080/86400 in the export. Or, if you like, the result of the data calculation without the format correcting multiplication in Monarch. So perhaps do the Monarch calculation without the multiplication and it is for the export and then have an extra field in Monarch that DOES do the multiplication but only so that you can confirm all looks well if you need to.

Does that help?

Grant