Here you can find the source of milliseconds(long p_days, long p_hours, long p_minutes, long p_hoursPerBusinessDay)
Parameter | Description |
---|---|
p_days | a long value representing the number of days |
p_hours | a long value representing the number of hours |
p_minutes | a long value representing the number of minutes |
p_hoursPerBusinessDay | - The conversion factor that indicates the number of business hours within a day. This value is an attribute of a calendar. |
public static long milliseconds(long p_days, long p_hours, long p_minutes, long p_hoursPerBusinessDay)
//package com.java2s; /**//from w ww . ja v a2 s .c o m * Copyright 2009 Welocalize, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ public class Main { private static final long MILLIS_PER_SECOND = 1000; private static final long SECONDS_PER_MINUTE = 60; private static final long MINUTES_PER_HOUR = 60; private static final long HOURS_PER_DAY = 24; public static long milliseconds(String p_days, String p_hours, String p_minutes) { return milliseconds(Long.valueOf(p_days), Long.valueOf(p_hours), Long.valueOf(p_minutes), HOURS_PER_DAY); } /** * Convert the given number of days, hours, and minutes into the * corresponding number of milliseconds. Return the result. * * @param p_days a long value representing the number of days * @param p_hours a long value representing the number of hours * @param p_minutes a long value representing the number of minutes * * @return a long value representing the number of milliseconds */ public static long milliseconds(long p_days, long p_hours, long p_minutes) { return milliseconds(p_days, p_hours, p_minutes, HOURS_PER_DAY); } /** * Convert the given number of days, hours, and minutes into the * corresponding number of milliseconds. Return the result. * * @param p_days a long value representing the number of days * @param p_hours a long value representing the number of hours * @param p_minutes a long value representing the number of minutes * @param p_hoursPerBusinessDay - The conversion factor that indicates * the number of business hours within a day. This value is an * attribute of a calendar. * * @return a long value representing the number of milliseconds */ public static long milliseconds(long p_days, long p_hours, long p_minutes, long p_hoursPerBusinessDay) { long seconds = p_days * p_hoursPerBusinessDay * MINUTES_PER_HOUR * SECONDS_PER_MINUTE; seconds += p_hours * MINUTES_PER_HOUR * SECONDS_PER_MINUTE; seconds += p_minutes * SECONDS_PER_MINUTE; return seconds * MILLIS_PER_SECOND; } }