Seconds to minutes

M

Matt

Hi all,

What is the easiest way to convert seconds to minutes. For example:

Field value is 336 (data type is long integer) I would like it to read 5:36
instead.

Any help is greatly appreciated. Thanks!

M.E.
 
M

Matt

Al,

Thanks for the help. One quick thing though....

A value like 242 shows up as 4:2. Is there any way to have the "0" before
the 2?


Al Campagna said:
Matt,
=Int([TimeInSeconds]/60) & ":" & [TimeInSeconds] Mod 60
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Matt said:
Hi all,

What is the easiest way to convert seconds to minutes. For example:

Field value is 336 (data type is long integer) I would like it to read 5:36
instead.

Any help is greatly appreciated. Thanks!

M.E.
 
J

John W. Vinson

Hi all,

What is the easiest way to convert seconds to minutes. For example:

Field value is 336 (data type is long integer) I would like it to read 5:36
instead.

Any help is greatly appreciated. Thanks!

M.E.

You can *DISPLAY* it using

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

The \ is an integer-divide operator, not a typo for /.

If you want to store the result in a Date/Time field - I'd suggest
that you don't; such fields don't work very well for storing
durations.

John W. Vinson [MVP]
 
M

Matt

Thanks John,

I am only using this to display it on a report. I wouldn't attempt storing
it like that.
When I enter the formula, it defaults to this when it calculates:
Expr1: [AHT]\60 & Format([AHT] Mod 60,":""00""").
It adds some extra quotation marks. The result is always X:00. Any ideas?

John W. Vinson said:
Hi all,

What is the easiest way to convert seconds to minutes. For example:

Field value is 336 (data type is long integer) I would like it to read 5:36
instead.

Any help is greatly appreciated. Thanks!

M.E.

You can *DISPLAY* it using

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

The \ is an integer-divide operator, not a typo for /.

If you want to store the result in a Date/Time field - I'd suggest
that you don't; such fields don't work very well for storing
durations.

John W. Vinson [MVP]
 
A

Al Campagna

Try...
Expr1: [AHT]\60 & Format([AHT] Mod 60,"\:00")
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Matt said:
Thanks John,

I am only using this to display it on a report. I wouldn't attempt storing
it like that.
When I enter the formula, it defaults to this when it calculates:
Expr1: [AHT]\60 & Format([AHT] Mod 60,":""00""").
It adds some extra quotation marks. The result is always X:00. Any ideas?

John W. Vinson said:
Hi all,

What is the easiest way to convert seconds to minutes. For example:

Field value is 336 (data type is long integer) I would like it to read 5:36
instead.

Any help is greatly appreciated. Thanks!

M.E.

You can *DISPLAY* it using

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

The \ is an integer-divide operator, not a typo for /.

If you want to store the result in a Date/Time field - I'd suggest
that you don't; such fields don't work very well for storing
durations.

John W. Vinson [MVP]
 
A

apollo8359

Wrap the expression in the format command and pick the style of formating
that you want. Al's expression will yield 4.2, but to get 04:02, do the
following. If you just want 4.02, as I now see in your question, make the
example "h:mm")

=Format(Int([TimeInSeconds]/60) & ":" & [TimeInSeconds] Mod 60,"hh:mm")

In the Access help you will find a large list of possible formatting options
relating to dates and times.

Matt said:
Al,

Thanks for the help. One quick thing though....

A value like 242 shows up as 4:2. Is there any way to have the "0" before
the 2?


Al Campagna said:
Matt,
=Int([TimeInSeconds]/60) & ":" & [TimeInSeconds] Mod 60
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Matt said:
Hi all,

What is the easiest way to convert seconds to minutes. For example:

Field value is 336 (data type is long integer) I would like it to read 5:36
instead.

Any help is greatly appreciated. Thanks!

M.E.
 

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