Java Second Convert convertTimeToSeconds(String a_time)

Here you can find the source of convertTimeToSeconds(String a_time)

Description

convert Time To Seconds

License

Apache License

Declaration

public static int convertTimeToSeconds(String a_time) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int convertTimeToSeconds(String a_time) {
        int secSinceMidnight = 0;
        int hours, minutes, seconds;
        String[] splitTime = a_time.split(":");

        hours = Integer.parseInt(splitTime[0]);
        minutes = Integer.parseInt(splitTime[1]);
        seconds = Integer.parseInt(splitTime[2]);

        secSinceMidnight = (3600 * hours) + (60 * minutes) + seconds;

        return secSinceMidnight;
    }/*from   www. j  a v  a2s. c o  m*/
}

Related

  1. convertSecondsToTimecode(float totalSeconds)
  2. convertSecondsToTimeUnits(int seconds)
  3. convertTimecodeToSeconds(String timecode)
  4. convertTimemilisecondsToHours(long time)
  5. convertTimeSecondsToHMS(long longSecs)
  6. convertToSeconds(String time)
  7. convertToSeconds(String timeStr)
  8. convertToTenthsOfASecond(long epochSeconds, int nanos)
  9. secondConvertToString(final long spentSeconds)