waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapCalendar2.java
public static double factorToGetSeconds(String units) throws Exception {
        units = units.trim().toLowerCase();
        if (units.equals("ms") || 
            units.equals("msec") || 
            units.equals("msecs") || 
            units.equals("millis") ||
            units.equals("millisec") ||
            units.equals("millisecs") ||
            units.equals("millisecond") ||
            units.equals("milliseconds")) return 0.001;      
        if (units.equals("s") || 
            units.equals("sec") || 
            units.equals("secs") || 
            units.equals("second") || 
            units.equals("seconds")) return 1;                 
        if (units.equals("m") || 
            units.equals("min") || 
            units.equals("mins") || 
            units.equals("minute") || 
            units.equals("minutes")) return SECONDS_PER_MINUTE; 
        if (units.equals("h") || 
            units.equals("hr") || 
            units.equals("hrs") || 
            units.equals("hour") || 
            units.equals("hours")) return SECONDS_PER_HOUR; 
        if (units.equals("d") || 
            units.equals("day") || 
            units.equals("days")) return SECONDS_PER_DAY;   
        if (units.equals("week") || 
            units.equals("weeks")) return 7 * SECONDS_PER_DAY;   
        if (units.equals("mon") ||
            units.equals("mons") ||
            units.equals("month") ||
            units.equals("months")) return 30 * SECONDS_PER_DAY;  
        if (units.equals("yr") || 
            units.equals("yrs") || 
            units.equals("year") || 
            units.equals("years")) return 360 * SECONDS_PER_DAY;

        throw new RuntimeException(
                ErddapString2.ERROR + " in Calendar2.factorToGetSeconds: units=\"" + units + "\" is invalid.");
    }
public static double factorToGetSeconds(String units) throws Exception {
        units = units.trim().toLowerCase();
        if (units.equals("ms") || 
            units.equals("msec") || 
            units.equals("msecs") || 
            units.equals("millis") ||
            units.equals("millisec") ||
            units.equals("millisecs") ||
            units.equals("millisecond") ||
            units.equals("milliseconds")) return 0.001;      
        if (units.equals("s") || 
            units.equals("sec") || 
            units.equals("secs") || 
            units.equals("second") || 
            units.equals("seconds")) return 1;                 
        if (units.equals("m") || 
            units.equals("min") || 
            units.equals("mins") || 
            units.equals("minute") || 
            units.equals("minutes")) return SECONDS_PER_MINUTE; 
        if (units.equals("h") || 
            units.equals("hr") || 
            units.equals("hrs") || 
            units.equals("hour") || 
            units.equals("hours")) return SECONDS_PER_HOUR; 
        if (units.equals("d") || 
            units.equals("day") || 
            units.equals("days")) return SECONDS_PER_DAY;   
        if (units.equals("week") || 
            units.equals("weeks")) return 7 * SECONDS_PER_DAY;   
        if (units.equals("mon") ||
            units.equals("mons") ||
            units.equals("month") ||
            units.equals("months")) return 30 * SECONDS_PER_DAY;  
        if (units.equals("yr") || 
            units.equals("yrs") || 
            units.equals("year") || 
            units.equals("years")) return 360 * SECONDS_PER_DAY;

        throw new RuntimeException(
                ErddapString2.ERROR + " in Calendar2.factorToGetSeconds: units=\"" + units + "\" is invalid.");
    }
public static double factorToGetSeconds ( String units ) throws Exception { units = units . trim ( ) . toLowerCase ( ) ; if ( units . equals ( "ms" ) || units . equals ( "msec" ) || units . equals ( "msecs" ) || units . equals ( "millis" ) || units . equals ( "millisec" ) || units . equals ( "millisecs" ) || units . equals ( "millisecond" ) || units . equals ( "milliseconds" ) ) return 0.001 ; if ( units . equals ( "s" ) || units . equals ( "sec" ) || units . equals ( "secs" ) || units . equals ( "second" ) || units . equals ( "seconds" ) ) return 1 ; if ( units . equals ( "m" ) || units . equals ( "min" ) || units . equals ( "mins" ) || units . equals ( "minute" ) || units . equals ( "minutes" ) ) return SECONDS_PER_MINUTE ; if ( units . equals ( "h" ) || units . equals ( "hr" ) || units . equals ( "hrs" ) || units . equals ( "hour" ) || units . equals ( "hours" ) ) return SECONDS_PER_HOUR ; if ( units . equals ( "d" ) || units . equals ( "day" ) || units . equals ( "days" ) ) return SECONDS_PER_DAY ; if ( units . equals ( "week" ) || units . equals ( "weeks" ) ) return 7 * SECONDS_PER_DAY ; if ( units . equals ( "mon" ) || units . equals ( "mons" ) || units . equals ( "month" ) || units . equals ( "months" ) ) return 30 * SECONDS_PER_DAY ; if ( units . equals ( "yr" ) || units . equals ( "yrs" ) || units . equals ( "year" ) || units . equals ( "years" ) ) return 360 * SECONDS_PER_DAY ; throw new RuntimeException ( ErddapString2 . ERROR + " in Calendar2.factorToGetSeconds: units=\"" + units + "\" is invalid." ) ; }
This returns the factor to multiply by 'units' data to get seconds
data (e.g., "minutes" returns 60).
This is used for part of dealing with udunits-style "minutes since 1970-01-01"-style
strings.

@param units
@return the factor to multiply by 'units' data to get seconds data.
Since there is no exact value for months or years, this returns
special values of 30*SECONDS_PER_DAY and 360*SECONDS_PER_DAY, respectively.
@throws Exception if trouble (e.g., units is null or not an expected value)
This returns the factor to multiply by units data to get seconds data ( e . g . minutes returns 60 ) . This is used for part of dealing with udunits - style minutes since 1970 - 01 - 01 - style strings .