Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Converting seconds to m.ss

Posted on 2003-11-22
2
Medium Priority
?
189 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 90 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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