Java TimeUnit Usage parseStringDate(String date)

Here you can find the source of parseStringDate(String date)

Description

parse String Date

License

Open Source License

Parameter

Parameter Description
date : string representing a unix timestamp (seconds since standard epoch of 1/1/1970)

Return

milliseconds since standard epoch of 1/1/1970

Declaration

public static Long parseStringDate(String date) 

Method Source Code

//package com.java2s;
/*/*from   www .  j av a2  s.  c  o m*/
 * Copyright ? R?gion Nord Pas de Calais-Picardie, 2016.
 *
 * This file is part of OPEN ENT NG. OPEN ENT NG is a versatile ENT Project based on the JVM and ENT Core Project.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation (version 3 of the License).
 *
 * For the sake of explanation, any module that communicate over native
 * Web protocols, such as HTTP, with OPEN ENT NG is outside the scope of this
 * license and could be license under its own terms. This is merely considered
 * normal use of OPEN ENT NG, and does not fall under the heading of "covered work".
 *
 * 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.
 */

import java.util.concurrent.TimeUnit;

public class Main {
    /**
     * @param date : string representing a unix timestamp (seconds since standard epoch of 1/1/1970)
     * @return milliseconds since standard epoch of 1/1/1970
     */
    public static Long parseStringDate(String date) {
        long seconds = Long.parseLong(date);
        return TimeUnit.MILLISECONDS.convert(seconds, TimeUnit.SECONDS);
    }
}

Related

  1. parseDate(String value)
  2. parseDuration(String durationStr)
  3. parseDuration(String text)
  4. parseRelativeTimeInSeconds(String relativeTime)
  5. parseSecondsFromEpoch(Double d)
  6. parseTimeMillis(String timeWithOrWithoutUnit)
  7. parseUntilTime(byte[] untilTime)
  8. pause()
  9. prettyMillis(long mil)