Hi
I have a decimal number 0.67.How do i convert this in to time(hh:MM) in a access query.
Hi
I have a decimal number 0.67.How do i convert this in to time(hh:MM) in a access query.
set the text box format to: hh:nn:ss
.67 of a 24 hr day is 1pm will give 16:04:48 HRS
or alter the table field type to DATE/TIME which will give the same result.
Is 0.67 representing a time of day or elapsed time? If that is elapsed time in decimal hour, then 0.67 = 40.2 minutes = 00:40:12 (HH:MM:SS)
Converting decimal time (or degrees) to an HH:MM:SS string is a common topic. https://support.microsoft.com/en-us/...-decimal-angle
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Its In double data type. i need to show 0.67 as 1h:07M
How did you get from 1:07 0,67?
0.67*(1 day) = 16h 4min, i.e. in access when you convert time 16:4 to double, you get 0.67
0.67*(1 hour) = 0.67*(1/24) = 0,0279166666666667 = 40 min, i.e. when you convert time 0:40 to double, you get 0,0279166666666667, and when you divide this with 0.67 you get 0,041667, which represent 1 hour.
I don't see any logical way to get 1:07 from 0.67!
Thanks
lets say it is 67minutes.how it can show as 1hrs and 7 minuites
Time and date are really numeric values [In Excel, In MS Access, In MS SQL Server). Date is integer (the number of days from some agreed date - for MS programs usually 01.01.1900), time is part of day (of 24 hours, so 1 hour is represented by value of 1/24, 1 minute is represented by 1/(24*60), 1.second is represented by 1/(24*60*60)]. Date and time format you apply is for display only - it doesn't change really the value in field.
So answer to your question is
and when the formula is in text box, then format text box e.g. as "hh:mm".Code:=67/(24*60)
Access will accept "hh:mm" and convert it to "Short Time". However, should probably get accustomed to using letter "m" to designate month and "n" for minutes. This will be critical in other functions such as DateDiff.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.