Back to Browse

Convert Time (mm:ss) to Seconds in Java | Easy Coding Interview Question | Java String Split Example

17 views
May 6, 2026
7:15

๐Ÿš€ In this video, we solve an important Java coding problem: ๐Ÿ‘‰ Convert video length from **mm:ss format to total seconds** ๐Ÿ’ก Example: * Input: 01:00 โ†’ Output: 60 * Input: 13:56 โ†’ Output: 836 * Input: 02:01 โ†’ Output: 121 --- ๐Ÿ”น **Concepts Covered:** * String Handling in Java * split() method * Integer Conversion * Basic Logic Building --- ๐Ÿง‘โ€๐Ÿ’ป **Code Used in This Video:** ```java Scanner s = new Scanner(System.in); String[] str = s.nextLine().split(":"); Integer n1 = Integer.valueOf(str[0]); Integer n2 = Integer.valueOf(str[1]); System.out.println((n1*60)+n2); ``` --- ๐Ÿ”ฅ This question is very useful for: โœ” Coding Interviews โœ” Java Beginners โœ” Practice Questions --- ๐Ÿ“Œ Donโ€™t forget to: ๐Ÿ‘ Like ๐Ÿ’ฌ Comment ๐Ÿ”” Subscribe for more Java coding videos --- #Java #Coding #JavaProgramming #InterviewQuestions #LearnJava

Download

1 formats

Video Formats

360pmp45.8 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Convert Time (mm:ss) to Seconds in Java | Easy Coding Interview Question | Java String Split Example | NatokHD