Solved

Converting seconds to m.ss

Posted on 2003-11-22
2
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

751 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