public static int unitsToSeconds ( String interval , String unit ) { if ( interval == null || interval . isEmpty ( ) ) return 0 ; else if ( unit == null ) return ( int ) ( Double . parseDouble ( interval ) ) ; else if ( unit . equals ( INTERVAL_DAYS ) ) return ( int ) ( Double . parseDouble ( interval ) * 86400 ) ; else if ( unit . equals ( INTERVAL_HOURS ) ) return ( int ) ( Double . parseDouble ( interval ) * 3600 ) ; else if ( unit . equals ( INTERVAL_MINUTES ) ) return ( int ) ( Double . parseDouble ( interval ) * 60 ) ; else return ( int ) ( Double . parseDouble ( interval ) ) ; }
Convert interval of specified unit to seconds