473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Subtract dates > 24hrs and display as days:hours:minutes

547 512MB
I try and subtract the admission and discharge dates of patients at a hospital.
discharge = discharge date (end) / admit = admission date (start)
I use the following code and it works but the layout/format is not what i require.
Expand|Select|Wrap|Line Numbers
  1. PatientDays: Int([discharge]-[admit]) & Format([discharge]-[admit],""" days ""h"" hrs, ""n"" min""")
i get this result
Expand|Select|Wrap|Line Numbers
  1. 2 days 10 hrs, 0 min
i would prefer it to be like this:
Expand|Select|Wrap|Line Numbers
  1. 02:10:00
Any suggestions pls?
Dec 1 '13 #1
2 1088
Luuk
1,047 Expert 1GB
You should try to understand how the function 'Format()' works.
(see: the manual)

next line might have the solution:
Expand|Select|Wrap|Line Numbers
  1. Int(discharge - admit) & Format([discharge] - [admit], """:""h"":""n"" """)
  2.  
Dec 1 '13 #2
neelsfer
547 512MB
Thx Luuk it works 100%. I have been trying all sorts of variations.
Dec 1 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ken | last post by:
$expirationdate = 4/15/2005 $startdate = 3/1/2005 I would like to determine the number of days between the above dates. My approach: $startdate = strtotime($startdate); // change to a string...
2
by: Tim | last post by:
Hello, I'm a xml beginner, buidling an app that translates xml to html using xmldom/msxml. I could use some help on the following issue. I have an xml file that contains descriptions of...
2
by: tshad | last post by:
I am trying to check the date of my field to check if it is greater that today, but I am getting an error. I am using : <asp:CompareValidator runat="server"...
0
by: tawxic | last post by:
My code is thus: <div id="navigation"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About Phazm</a></li> <li><a href="#">Services Offered</a></li> <li><a href="#">Request...
4
by: Winston | last post by:
Where is the mistake? I want to make a simple menu. These are two pieces of two files... function ShowMenu(objeto) { is_open = document.getElementById(objeto).style.display;...
8
by: Remington | last post by:
I am using windows 2000pro with access 2000. I am trying to make a database for our HR department, that would allow our HR Director to type in an employee's ID number into a form and then select...
31
by: dragonlady | last post by:
I have a table with the fields - Income_Date Income. 19/3/07 $320 21/2/07 $200 27/1/07 $300 In a continuous subform, I need to show for each income period...
0
by: Andy Dingley | last post by:
Background: I have a bunch of (yet unwritten) code for a JSP tag library to generate "tables" of data.The same tag library will be re-used to generate a great many "complex data view" pages. In...
2
by: barronmo | last post by:
I'm trying to get the difference in dates using the time module rather than datetime because I need to use strptime() to convert a date and then find out how many weeks and days until that date. ...
4
by: steve75043 | last post by:
Hello I hope someone can help with this. I need to subtract dates in current record from previous record for the current store. The key fields in the form are customer, store number and date picked...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.