covert number to time

H

Harold Ducote

I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.



Harold Ducote
(e-mail address removed)
Frank's Casing Crew
Info Resources Coordinator
337-572-2313 phone
337-572-2462 fax.
 
J

John Vinson

I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.

How is [Duration] calculated? Am I right in guessing that it's a count
of seconds, and you want to see it in hours and minutes?

If so, construct a String using an expression

[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")
 
H

Harold Ducote

thanks this work out perfect...

Harold Ducote
(e-mail address removed)
Frank's Casing Crew
Info Resources Coordinator
337-572-2313 phone
337-572-2462 fax.


Format(Sum([Duration]/3600), "ShortTime")

--
Ken Snell
<MS ACCESS MVP>

Harold Ducote said:
I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.



Harold Ducote
(e-mail address removed)
Frank's Casing Crew
Info Resources Coordinator
337-572-2313 phone
337-572-2462 fax.
 
H

Harold Ducote

when i used the below expression it gives me a error of

You tired to execute a query that does not include the specified expression
'[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")' as part of an
aggregate function.

any idea i would like it to show just as you described.

Harold Ducote
(e-mail address removed)
Frank's Casing Crew
Info Resources Coordinator
337-572-2313 phone
337-572-2462 fax.


I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.

How is [Duration] calculated? Am I right in guessing that it's a count
of seconds, and you want to see it in hours and minutes?

If so, construct a String using an expression

[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")
 
J

John Vinson

when i used the below expression it gives me a error of

You tired to execute a query that does not include the specified expression
'[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")' as part of an
aggregate function.

any idea i would like it to show just as you described.

If Ken's solution doesn't work for you, please post the complete SQL
string of your query.
 
K

Ken Snell

Some additional info re: using the ":00" format approach. In working through
another poster's problem, I found out that the ":00" format will always
return ":00" regardless of the value that is being formatted.

I had to do it this way:

Format([Duration] \ 3600, "0:") & Format([Duaration] Mod 60, "00")


--
Ken Snell
<MS ACCESS MVP>

John Vinson said:
I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.

How is [Duration] calculated? Am I right in guessing that it's a count
of seconds, and you want to see it in hours and minutes?

If so, construct a String using an expression

[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")
 
H

Harold Ducote

still the same error message here is the sql query that i'm running

SELECT txtusername.txtusername, Format([Duration]\3600,"0\:") &
Format([Duaration] Mod 60,"00") AS Expr1
FROM ((txtusername INNER JOIN (dbo_Connections INNER JOIN dbo_Workstations
ON dbo_Connections.Workstation_Id = dbo_Workstations.Workstation_Id) ON
txtusername.txtusername = dbo_Workstations.User_Name) INNER JOIN dbo_Pages
ON dbo_Connections.Page_Id = dbo_Pages.Page_Id) INNER JOIN dbo_Sites ON
dbo_Pages.Site_Id = dbo_Sites.Site_Id
GROUP BY txtusername.txtusername
ORDER BY Format([Duration]\3600,"0\:") & Format([Duaration] Mod 60,"00")
DESC;


Harold Ducote
(e-mail address removed)
Frank's Casing Crew
Info Resources Coordinator
337-572-2313 phone
337-572-2462 fax.


Some additional info re: using the ":00" format approach. In working
through
another poster's problem, I found out that the ":00" format will always
return ":00" regardless of the value that is being formatted.

I had to do it this way:

Format([Duration] \ 3600, "0:") & Format([Duaration] Mod 60, "00")


--
Ken Snell
<MS ACCESS MVP>

John Vinson said:
I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.

How is [Duration] calculated? Am I right in guessing that it's a count
of seconds, and you want to see it in hours and minutes?

If so, construct a String using an expression

[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")
 
K

Ken Snell

Try this:

SELECT txtusername.txtusername, Format([Duration]\3600,"0\:") &
Format([Duaration] Mod 60,"00") AS Expr1
FROM ((txtusername INNER JOIN (dbo_Connections INNER JOIN dbo_Workstations
ON dbo_Connections.Workstation_Id = dbo_Workstations.Workstation_Id) ON
txtusername.txtusername = dbo_Workstations.User_Name) INNER JOIN dbo_Pages
ON dbo_Connections.Page_Id = dbo_Pages.Page_Id) INNER JOIN dbo_Sites ON
dbo_Pages.Site_Id = dbo_Sites.Site_Id
GROUP BY txtusername.txtusername, Format([Duration]\3600,"0\:") &
Format([Duaration] Mod 60,"00")
ORDER BY Format([Duration]\3600,"0\:") & Format([Duaration] Mod 60,"00")
DESC;


--
Ken Snell
<MS ACCESS MVP>


Harold Ducote said:
still the same error message here is the sql query that i'm running

SELECT txtusername.txtusername, Format([Duration]\3600,"0\:") &
Format([Duaration] Mod 60,"00") AS Expr1
FROM ((txtusername INNER JOIN (dbo_Connections INNER JOIN dbo_Workstations
ON dbo_Connections.Workstation_Id = dbo_Workstations.Workstation_Id) ON
txtusername.txtusername = dbo_Workstations.User_Name) INNER JOIN dbo_Pages
ON dbo_Connections.Page_Id = dbo_Pages.Page_Id) INNER JOIN dbo_Sites ON
dbo_Pages.Site_Id = dbo_Sites.Site_Id
GROUP BY txtusername.txtusername
ORDER BY Format([Duration]\3600,"0\:") & Format([Duaration] Mod 60,"00")
DESC;


Harold Ducote
(e-mail address removed)
Frank's Casing Crew
Info Resources Coordinator
337-572-2313 phone
337-572-2462 fax.


Some additional info re: using the ":00" format approach. In working
through
another poster's problem, I found out that the ":00" format will always
return ":00" regardless of the value that is being formatted.

I had to do it this way:

Format([Duration] \ 3600, "0:") & Format([Duaration] Mod 60, "00")


--
Ken Snell
<MS ACCESS MVP>

John Vinson said:
I have the following Sum([Duration]/3600) and it gives me a number in a
query. How would I also format this to short time to maybe show like 1:30.
is there a way to do this.

How is [Duration] calculated? Am I right in guessing that it's a count
of seconds, and you want to see it in hours and minutes?

If so, construct a String using an expression

[Duration] \ 3600 & Format(([Duration] \ 60) MOD 60, ":00")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top