This topic is locked

calculate lenght of stay

10/2/2009 5:50:40 AM
PHPRunner General questions
woodey2002 author

Hi Guys

i have two fields in my database "date of admission" and "date of discharge"
i would like to be able to calculate a patients length of stay and show that somewhere on the form.
Is that possible with PhpRunner or do i need to use some javascript?
Many thanks Again.
JAMES
PhpRunner's number1 Irish Fan <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=12838&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

J
Jane 10/2/2009

James,
use Before record added/Before record updated events on the Events tab to calculate this value.

Here is a sample:

$values["FieldName"] = (strtotime($values["date of admission"])-strtotime($values["date of discharge"]))/(60*60*24);