All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hyperledger.fabric_ca.sdk.helper.Util Maven / Gradle / Ivy

There is a newer version: 2.2.26
Show newest version
package org.hyperledger.fabric_ca.sdk.helper;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Util {

    /**
     * Converts Date type to String based on RFC3339 formatting
     *
     * @param date
     * @return String
     */
    public static String dateToString(Date date) {
        final TimeZone utc = TimeZone.getTimeZone("UTC");

        SimpleDateFormat tformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
        tformat.setTimeZone(utc);
        return tformat.format(date);
    }

    /**
     * Private constructor to prevent instantiation.
     */
    private Util() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy