Here you can find the source of getISOFromMillisec(long timeMillisecGMT)
Parameter | Description |
---|---|
timeMillisecGMT | a parameter |
public static String getISOFromMillisec(long timeMillisecGMT)
//package com.java2s; /***************************************************************************** * Source code information// w w w . j av a 2s . com * ----------------------- * Original author Luis Bermudez, SURA * Author email bermudez@sura.org * Package org.oostethys.netcdf.util * Web http://marinemetadata.org/mmitools * Created Dec 4, 2006 * Filename $RCSfile: TimeUtil.java,v $ * Revision $Revision: 1.2 $ * * Last modified on $Date: 2008/06/19 19:47:44 $ * by $Author: luisbermudez $ * * (c) Copyright 2005, 2006 Monterey Bay Aquarium Research Institute * Marine Metadata Interoperability (MMI) Project http://marinemetadata.org * * License Information * ------------------------ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed 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 have received a copy of the GNU General Public License * along with this program; if not, you can download it from * http://marinementadata.org/gpl or write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *********************************************************************************/ import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private SimpleDateFormat format; private static SimpleDateFormat formatISODefault = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); /** * Returns time form ISO given millisec since EPOCH * * @param timeMillisecGMT * @return */ public static String getISOFromMillisec(long timeMillisecGMT) { formatISODefault.setTimeZone(TimeZone.getTimeZone("GMT")); return formatISODefault.format(new Date(timeMillisecGMT)); } /** * Returns time form ISO given millisec since EPOCH * * @param timeMillisecGMT * @return */ public static String getISOFromMillisec(double timeMillisecGMT) { formatISODefault.setTimeZone(TimeZone.getTimeZone("GMT")); DecimalFormat df = new DecimalFormat("#0"); long millisec = Long.parseLong(df.format(timeMillisecGMT)); return formatISODefault.format(millisec); } }