/******************************************************************************
* Copyright © 2013-2016 The Nxt Core Developers. *
* *
* See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Nxt software, including this file, may be copied, modified, propagated, *
* or distributed except according to the terms contained in the LICENSE.txt *
* file. *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
package nxt.util;
import org.junit.Assert;
import org.junit.Test;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class EpochTimeTest {
@Test
public void simple() {
long time = Convert.fromEpochTime(47860355);
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
Assert.assertEquals("01/06/2015 10:32:34", dateFormat.format(new Date(time)));
Assert.assertEquals(47860355, Convert.toEpochTime(time));
}
}