Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 794251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:17:07+00:00 2026-05-14T22:17:07+00:00

what about this one: I want to format the currentTime displayed by a videoPlayer

  • 0

what about this one:

I want to format the currentTime displayed by a videoPlayer component inside flex, something like : 8230.999 to something like 01:59:59:999 which is "hours:minutes:seconds:milliseconds"

I trie different sets of codes but they can’t get it to work because currentTime is nor a correct miliseconds time as it adds a floating 3 digit point to seconds;

so instead of : 2000ms it outputs 2.000

something people like me just can’t understand!

thanx for any help 🙂

### UPDATE

I still have problem with milliseconds.
here’s the current MXML:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

    <fx:Script>
        <![CDATA[
            protected function convert_clickHandler(event:MouseEvent):void
            {
                var val:Number = new Number(inPut.text); //inPut.text = 1000.001

                //val = val * 1000;
                outPut.text = timeFormat(val);
            }
            public static function timeFormat(value:Number):String
            {
                var milliseconds:Number  = value % 1000;
                var seconds:Number  = Math.floor((value/1000) % 60);
                var minutes:Number  = Math.floor((value/60000) % 60);
                var hours:Number  = Math.floor((value/3600000) % 24);

                var s_miliseconds:String     = (milliseconds<10 ? "00" : (milliseconds<100 ? "0" : ""))+ String(milliseconds);
                var s_seconds:String     = seconds < 10 ? "0" + String(seconds) : String(seconds); 
                var s_minutes:String     = minutes < 10 ? "0" + String(minutes) : String(minutes); 
                var s_hours:String     = hours < 10 ? "0" + String(hours) : String(hours);

                return s_hours  + ":" + s_minutes  + ":" + s_seconds + '.'+s_miliseconds;
                // returns 00:00:01.000.0009999999999763531 should return 00:00:01.001
                // I still have problem with milliseconds
            }

        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:TextInput x="240" y="72" id="inPut" text="1000.001"/>
    <s:TextInput x="240" y="140" id="outPut"/>
    <s:Button x="274" y="107" label="convert" id="convert" click="convert_clickHandler(event)"/>
</s:Application>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:17:07+00:00Added an answer on May 14, 2026 at 10:17 pm

    A correct one:

    I made this one. A complete class.

    package com.strangemother.utils
    {
        public class Time extends Object
        {
    
            public function Time()
            {
            }
    
            public static function timeFormat(value:int):String
            {
                var seconds:Number  = value % 60;
                var minutes:Number  = Math.floor((value % 3600 ) /60);
    
                var minuteString:String     = minutes < 10 ? "0" + String(minutes) + ":" : String(minutes) + ":";   
                var secondString:String     = seconds < 10 ? "0" + String(seconds) : String(seconds);
                return minuteString + secondString;
            }
    
    
        }
    }
    

    this works – Googled it.

    var secondsPerMinute = 60;
    var minutesPerHour = 60;
    function convertSecondsToHHMMSS(intSecondsToConvert) {
    var hours = convertHours(intSecondsToConvert);
    var minutes = getRemainingMinutes(intSecondsToConvert);
    minutes = (minutes == 60) ? "00" : minutes;
    var seconds = getRemainingSeconds(intSecondsToConvert);
    return hours+" : "+minutes+" : "+seconds;
    }
    function convertHours(intSeconds) {
    var minutes = convertMinutes(intSeconds);
    var hours = Math.floor(minutes/minutesPerHour);
    return hours;
    }
    function convertMinutes(intSeconds) {
    return Math.floor(intSeconds/secondsPerMinute);
    }
    function getRemainingSeconds(intTotalSeconds) {
    return (intTotalSeconds%secondsPerMinute);
    }
    function getRemainingMinutes(intSeconds) {
    var intTotalMinutes = convertMinutes(intSeconds);
    return (intTotalMinutes%minutesPerHour);
    }
    
    trace(convertSecondsToHHMMSS(13345)); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm about to lose my mind on this one right here. I'd like to
I know a lot about C# but this one is stumping me and Google
I'm quite curious about this. In a broad way, how does one go about
Surprisingly I was only able to find one previous question on SO about this
I'm trying to learn about trees by implementing one from scratch. In this case
I'm just wondering about this one. I'm creating an ASP.NET webform containing lots of
I want to format a XML document during unmarshal with JAXB. Unmarshal looks like:
I've been thinking about this object oriented design question for a while now and
What do you think about this build tool ? I'm thinking of migrating from
I know about this question: Which (third-party) debug visualizers for Visual Studio 2005/2008 do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.