Here you can find the source of getDate(final int oceanTime)
Parameter | Description |
---|---|
oceanTime | The specified date as the number of seconds since 1980. |
public static Date getDate(final int oceanTime)
//package com.java2s; /*/* w ww. ja v a 2 s. c o m*/ * Telsis Limited jOCP library * * Copyright (C) Telsis Ltd. 2011-2013. * * This Program is free software: you can copy, redistribute and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License or (at your option) any later version. * * If you modify this Program you must mark it as changed by you and give a relevant date. * * This Program is published in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. You should * receive a copy of the GNU General Public License along with this program. If not, * see <http//www.gnu.org/licenses/>. * * In making commercial use of this Program you indemnify Telsis Limited and all of its related * Companies for any contractual assumptions of liability that may be imposed on Telsis Limited * or any of its related Companies. * */ import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { /** The number of seconds between 1970 and 1980. */ public static final int NO_SECONDS_1970_1980 = 315532800; /** * Convert the specified Ocean time to a Java {@link Date}. * * @param oceanTime * The specified date as the number of seconds since 1980. * @return The specified date as a Java {@link Date}. */ public static Date getDate(final int oceanTime) { return new Date(TimeUnit.MILLISECONDS.convert(((long) oceanTime) + NO_SECONDS_1970_1980, TimeUnit.SECONDS)); } }