how to convert youtube videos duration time to seconds
Hi
I have the duration for youtube videos in the format 12M34S (12 minutes and 34 seconds) how to convert this to seconds? is there any function for this? thanks in advance
I add the code for this:
void Start () {
var dura = "7M25S";
var arr = dura.Split(new string[] { "M" }, StringSplitOptions.None);
arr[0] = arr[0].Trim();
arr[1] = arr[1].Trim().Replace("S","");
var durat = (int.Parse (arr [0]) * 60) + int.Parse(arr [1]);
Debug.Log(durat);
}
I hate stupid god thinking people closing questions from other people. He closes the questions and avoid get responses. Does it bother you that it is open and that someone can respond? Stupid people.
This isn't related to Unity at all. Or if it is you failed to show the link betweeh your Unity project and the start time stamp of youtube videos.
Apart from that your "youtube time" is a string. So you would need to split it into it's parts, strip away any characters which are not numbers, parse those string parts into actual numbers and assemble a single number from those numbers. It should be obvious that you have to multiply the $$anonymous$$utes by 60 and add the seconds.
Though since this question is off topic i will close the question.
The project is not needed. The start time is shown in the question: format 12$$anonymous$$34S (12 $$anonymous$$utes and 34 seconds) .
If my question is not right made, how have you understood the problem and give a response? Seems you are a stupid moderator with some kind of problem and wants revenge with the newbies...
BTW, thanks for your response. Put me in the right way for solve the problem. Thanks.
UnityAnswer is for questions about Unity. So every question needs to have some relevance within the scope of Unity.
UnityAnswers is not a general purpose Q&A site. There are countless other general purpose sites out there. For general program$$anonymous$$g questions there is StackOverflow. Though they have much stricter rules which questions are allowed.
Note that all the examples of other questions still fall within the scope of Unity. The first one was a syntax question about UnityScript (which Unity advertised as JavaScript). The second one, even it was a C# question, clearly was within the scope of Unity. Also note that those questions all have included the code what they have tried so far to solve their problem but they got stuck at some point. Your question didn't include any reference just asks for a solution.
Feel free to read the moderator guidelines yourself.
Since you now have added a code snippet which at least gives some Unity relationship I can move your question into the HelpRoom.
[5]: https://answers.unity.com/page/faq.html