473,405 Members | 2,261 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,405 software developers and data experts.

convert seconds to days:hrs:min

547 512MB
I use the following query to convert the average of seconds taken to treat patients in a hospital ward, to hours:min:sec , but has a problem when it exceeds 24hrs in a hospital. I first converted the hh:min:sec to seconds, in order to calculate average times.
Expand|Select|Wrap|Line Numbers
  1. seconds: DateDiff("s",[admit],[discharge])
then use this to convert back after calculations as long as it does not exceed 24hrs

Expand|Select|Wrap|Line Numbers
  1. time: Format([avgofSeconds]\3600,"00") & ":" & Format(([avgofSeconds]-([avgofSeconds]\3600)*3600)\60,"00") & ":" & Format(([avgofSeconds] Mod 3600)-(([avgofSeconds]-([avgofSeconds]\3600)*3600)\60)*60,"00")
I need to display the seconds as dd:hr:min if it can be done in Access pls. Anybody that has done this?
Dec 8 '13 #1
1 1188
zmbd
5,501 Expert Mod 4TB
neelsfer:

Standard time functions assume that you want to use the clock and report in real time; whereas, what you want is elapsed time. There's a ton of code snipits on the net to do this.

OE:
You can do sucessive division.
S/60 = Min
Min/60 = Hours

The "\" division will return just the IP
(from the developer's reference:
Remarks

Before division is performed, the numeric expressions are rounded to Byte, Integer, or Long expressions.

Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Long variant, regardless of whether result is a whole number. Any fractional portion is truncated. However, if any expression is Null, result is Null. Any expression that is Empty is treated as 0.

Example
This example uses the \ operator to perform integer division.

Dim MyValue
MyValue = 11 \ 4 ' Returns 2.
MyValue = 9 \ 3 ' Returns 3.
MyValue = 100 \ 3 ' Returns 33.
Mod() will return remainders.

You then take the values and build your string for the report.
Dec 8 '13 #2

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

Similar topics

2
by: Rudi Groenewald | last post by:
Hi all. If I've got a query which has a field with seconds in it... how will I use the Convert function to get my field converted to the format: HH:MM:SS ? The field with the seconds in is...
7
by: tshad | last post by:
Is there a quick function in vb out there that will convert seconds to minutes and seconds? Thanks, Tom
2
by: 00_CP_D12 | last post by:
Is there an easy way in ASP.NET to convert seconds to Hours: Minutes: Seconds? For example, 65 seconds will return 0 hr, 1 min, 5 secs. Thanks...
6
by: Mike | last post by:
I'm getting my data from my database in seconds, 3600, how can i convert that to time such as 1:00 pm?
5
by: Terry Diederich | last post by:
I need to pull some data out of a database where the date fields are being stored as long integers which represent the number of seconds since midnight Jan 1, 1970. I need to convert these values...
14
by: Michael Barrido | last post by:
I have this for example: Dim iSeconds as int32 = 3600 '3600 seconds is one hour How do i convert it to "01:00:00" ? Please help. Thanks in advance!
7
by: Bilwin | last post by:
Hi friends, I need to convert the seconds into date and time which will be in the format yyyy-mm-dd hr:min:sec. how can i convert this.please reply me. thanks.
7
by: jimmy1 | last post by:
Hello everyone I am trying to find a way to convert seconds to minutes in the script below - Private Sub cmdBegin_Click() On Error Resume Next n = Val(txttime.Text) * 60 tmrClock.Enabled = True...
5
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have about ten integer values that each need to be converted to days, hours, minutes and seconds. I can't seem to find a formula for same that works. These integer values come from a...
2
by: Martha Amer | last post by:
Hello, I have a device which stores time in its flash memory as the number of seconds since 01/01/1970. One of my roles is to get/set its time. I would like to know the most efficient code to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.