Here you can find the source of getDateOf(final BigInteger fileTime)
Parameter | Description |
---|---|
fileTime | Time in 100ns since 1 jan 1601 |
public static GregorianCalendar getDateOf(final BigInteger fileTime)
//package com.java2s; /*//from w ww . j av a2s . c om * Entagged Audio Tag library * Copyright (c) 2004-2005 Christian Laireiter <liree@web.de> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import java.math.BigInteger; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static final long DIFF_BETWEEN_ASF_DATE_AND_JAVA_DATE = 11644470000000l; /** * Date values in ASF files are given in 100 ns (10 exp -4) steps since first * * @param fileTime Time in 100ns since 1 jan 1601 * @return Calendar holding the date representation. */ public static GregorianCalendar getDateOf(final BigInteger fileTime) { final GregorianCalendar result = new GregorianCalendar(); // Divide by 10 to convert from -4 to -3 (millisecs) BigInteger time = fileTime.divide(new BigInteger("10")); // Construct Date taking into the diff between 1601 and 1970 Date date = new Date(time.longValue() - DIFF_BETWEEN_ASF_DATE_AND_JAVA_DATE); result.setTime(date); return result; } }