Jump to content
dynamitemedia

00:00:22.17 mp3 time to millisecond

Recommended Posts

dynamitemedia

i can find how to do the opposite but i want to take

00:00:22.17  and put into milliseconds

which would be 22017 ?? or no

seems like it should be super simple but not finding it anywhere.

i get a bunch of audio files with that time stamp and i and i want to to convert to milliseconds

thanks!

Share this post


Link to post
Share on other sites
water

What have you tried yourself so far?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
mikell

This reminds me something  :)

Msgbox(0,"", Convert2ms("00:00:22.17") )

Func Convert2ms($sTime) ;format "HH:MM:SS.ms", no error / validity check for input!
    Return Execute("'" & StringRegExpReplace($sTime, "(\d+):(\d+):(\d+)\.(\d*)", _ 
            "' & $1*3600*1000+$2*60*1000+$3*1000+$4 & '") & "'")
EndFunc
  • Like 1

Share this post


Link to post
Share on other sites
TheSaint

Check out the StringSplit function as one method to get an array, which you will need to do twice. ;)

Hours times 60 to get minutes.

Minutes times 60 to get seconds.

Seconds times 1000 to get milliseconds.

We could provide the code easy enough, but I believe in helping those who help themselves, so as water said, provide us with what you have tried so far, or with what I have now given you a clue to, if necessary. :)

We can help fine tune any issues you can't surmount. :D


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
TheSaint

@mikell - I know you are trying to be helpful, but giving a golden platter solution like that to a seeming newbie, is not really teaching them anything.

As they say, best to learn to walk before learning to ride.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
mikell

TheSaint,

You are obviously right but I couldn't help but posting it  :D

BTW I would say lazy instead of newbie

Share this post


Link to post
Share on other sites
water

It is a quite advanced solution (at least for me as I'm not good with regular expressions).

I would have - like TheSaint - suggested to start with StringSplit.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
TheSaint

TheSaint,

You are obviously right but I couldn't help but posting it  :D

BTW I would say lazy instead of newbie

Nothing wrong with posting it once they had tried and succeeded with an easier method. :)

After all, they won't be a newbie forever and many others will see this topic perhaps, and benefit from an advanced solution.

Probably not water and I though, as we tend to avoid RegExp stuff ... so we can sleep at night.

;)

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
dynamitemedia

I was not being lazy if you see all my posts here i show my solutions every time, not to mention i ask to be sent in right direction...  this topic was not covered anywhere i could find.

i got stuck for hours and wanted to see if anyone had any ideas and when i woke up could work again, no reason to start making assumptions about my laziness etc.

I didn't know where to start is why i started the thread. never said hand me over code.   thanks mikell that is what i was thinking about b4 i went to bed last night.  i wasnt sure it would be that simple i thought i would need to be doing some addition etc... 

 

Share this post


Link to post
Share on other sites
jguinch

@Mikell : just a small remark. You can remove your concatenation and juste keep the calculation :;) 

Func Convert2ms($sTime)
    Return Execute(StringRegExpReplace($sTime, "(\d+):(\d+):(\d+)\.(\d*)", "($1*3600+$2*60+$3)*1000+$4") )
EndFunc

 

Edited by jguinch
  • Like 1

Share this post


Link to post
Share on other sites
UEZ

Non regex version:

Func Convert2ms($sTime)
    Return StringLeft($sTime, 2) * 3600000 + StringMid($sTime, 4, 2) * 60000 + StringMid($sTime, 7, 2) * 1000 + StringRight($sTime, 2)
EndFunc

 

  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
mikell

jguinch,

Thanks for the tip. Less quotes, mmm... lovely  :lmao:

 

UEZ,

I remember the former topic, there is one example more using StringSplit   :D

Share this post


Link to post
Share on other sites
UEZ

Regex is not only for beginners not easy to understand. Further many ways lead to Rome and it is always good to see more ways. :)

 

  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • nooneclose
      By nooneclose
      I need help turning this string "20180913221626" into a formatted time string.
      I need to go from this: 20180913221626
      to this: 09/13/2018 10:16 PM
      I do not always know what the date will be so I can not just use a variable I need to actually convert/format. 
      I did see an older post in the forms that was basically the same question only the other guy did not post the working code and I can not figure out how to use _AD_GetObjectProperties properly to get what I want. 
      As always any help would be appreciated. 
      Here is the code I use to find the date, but it always gives me the unformatted version. 
      ;retrieve the items object $oItem = $oOutlook.Session.GetItemFromID($aItems[1][0], Default) $oItem.GetInspector $eSentOn = $oItem.SentOn ; When was the email sent? MsgBox("", "Sent On of the email", $eSentOn) ;******************************************************************************* ; Formats the date and time from the email ;******************************************************************************* ;Local $fDatenTime = _DateTimeFormat($eSentOn, 1) ;MsgBox("", "Formatted email time", $fDatenTime) $aProperties = _AD_GetObjectProperties($eSentOn) _ArrayDisplay($aProperties, "Did the conversion work?")  
    • rudi
      By rudi
      Hello,
      Propably not an absolute clean approach, (not checking/caring about little / big endian), but it's doing, what I need: Return the last modified time stamp including the milliseconds:
       
      #include <Date.au3> $file = "c:\temp\test.txt" ; file must already exist $TSLastModMs = GetFileLastModWithMs($file) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $TSLastModMs = ' & $TSLastModMs & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Func GetFileLastModWithMs($_FullFilePathName) local $h = _WinAPI_CreateFile($_FullFilePathName, 2, 2) local $aTS = _Date_Time_GetFileTime($h) _WinAPI_CloseHandle($h) local $aDate = _Date_Time_FileTimeToArray($aTS[2]) ; [2] = LastModified Return StringFormat("%04d-%02d-%02d %02d:%02d:%02d.%03d", $aDate[2], $aDate[0], $aDate[1], $aDate[3], $aDate[4], $aDate[5], $aDate[6]) EndFunc ;==>GetFileLastModWithMs >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\temp\filetime.au3 +>12:10:00 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\temp\filetime.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop @@ Debug(8) : $TSLastModMs = 2018-09-07 10:09:54.073 >Error code: 0 +>12:10:00 AutoIt3.exe ended.rc:0 +>12:10:00 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.9068 Regards, Rudi.
       
      --- original posting - what was my problem, below ---
       
      doing some search I found postings, stating that 2s will be the smallest time resolution for filegettime(). 2s seem to be fact for FAT as FS, NTFS has a much finer granularity.
       
      This posting states, that NTFS has a granularity of 100ns:
      https://superuser.com/questions/937380/get-creation-time-of-file-in-milliseconds
      is it possible to get more than just the "second" information? The reason, why I need this is, that I need to sort files by their creation sequence, and it can happen, that two files are created within the same second, so I cannot resolve their creation order without "millsecond info".
       
      Regards, Rudi.

       
      edit: I just tried PowerShell, there it's possible to retrieve even more than millisecond information:
       
      Millisecond : 336
      Ticks       : 636719150403363219
      TimeOfDay   : 11:04:00.3363219
       
      PS C:\Users\Rudi> echo test > test.txt PS C:\Users\Rudi> $(Get-ChildItem .\test.txt).creationtime | format-list Date : 07.09.2018 00:00:00 Day : 7 DayOfWeek : Friday DayOfYear : 250 Hour : 11 Kind : Local Millisecond : 336 Minute : 4 Month : 9 Second : 0 Ticks : 636719150403363219 TimeOfDay : 11:04:00.3363219 Year : 2018 DateTime : Freitag, 7. September 2018 11:04:00 regards, Rudi.
    • Jemboy
      By Jemboy
      Hi,
      Ones(some times twice) a month I get an e-mail with zip file, which has price updates from a supplier.
      I have to upload the file to an FTP to get it processed.
      When uploading the file, it will get "timestamped" with the time and date at which time the file was uploaded.
      Normally this is fine, because I mostly upload the file the same day.
      Sometimes it may take 1 or 2 days before I can upload the file.
      For historical purpose, I would like to have the file timestamped with the original date.
      I have tried using:  _FTP_Command ( $hFTPSession, "MFCT YYYYMMDDHHMMSS path") 
      however this command does not work or change the timestamp as I expected.
      Does anyone now a way how I can change the timestamp of a FTP-file?
    • Rskm
      By Rskm
      Hi, for a script of mine, I wish to keep a time frame on till how the program will work.. basically, I want the program to read the date and if the read date < 'a particular date', the program continues, else it exit. I don't want to read the time from the computer as the program can be fooled by resetting the pc time. is there a way to read time from internet - so that the user cannot fool the program by date reset? thanks
    • Shedunn
      By Shedunn
      I've been looking through some different functions(not sure if that's the right word) to get the Date and time and I can't find one that doesn't include "/ " or ":" in what is returned.

      I'm trying to create a file name with this format "QuickConfig_MMDDYYYY_HHMM"  (doesn't matter if 24 or 12hr format)
      #include <Date.au3> Func _SaveConfig MouseClick('primary',155, 46, 1, 0) ;clicks save as WinWait('Save bluePRINT Configuration As...','', 4) MouseClick('primary',632, 47, 1, 0) ;clicks the file path bar $Documents = @MyDocumentsDir $FilePath = $Documents & '\BP3 Configs' Send($FilePath) Send('{ENTER}') MouseClick('primary',166, 580, 1, 0) ;clicks file name bar $FileName = 'QuickConfig_' & _NowDate & '_' & _NowTime Send($FileName) Send('{ENTER}') EndFunc  
       
      I'm wondering if there is a function somewhere to do this?
×