Solved

Converting seconds to m.ss

Posted on 2003-11-22
2
183 Views
Last Modified: 2010-05-01
Hi Experts,

I am working on a way of converting seconds to m.ss but all i can get is hh.mm.ss using:

VarSeconds = 313.069875
VarTime = Format(DateAdd("s", VarSeconds, "00:00:00"), "hh.mm.ss")

This returns the time 00.05.13, but i would like 5.13 to be returned.

Also if the time is for example 10 minutes it needs to return 10.00 and not 0.00


Any ideas??

Thanks
robbrownuk
0
Comment
Question by:robbrownuk
2 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 30 total points
ID: 9803746
Try this:

VarTime =  CStr(VarSeconds \ 60) & ":" & CStr(VarSeconds Mod 60)

Anthony
0
 
LVL 2

Author Comment

by:robbrownuk
ID: 9803854
That works great - just modified it a bit because 5 minutes was reading as 5:0 not 5:00.

Final Code:

VarTime = CStr(VarSeconds \ 60) & ":" & Format(CStr(VarSeconds Mod 60), "0#")


Thanks Anthony,

robbrownuk
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question