Java Date Format ISO getISO8601Date(long millis)

Here you can find the source of getISO8601Date(long millis)

Description

Get valid ISO 8601 date out of a given time in milliseconds.

License

Apache License

Parameter

Parameter Description
millis Time in milliseconds to convert.

Return

Valid string representation in ISO 8601 format of the given time in milliseconds.

Declaration

public static String getISO8601Date(long millis) 

Method Source Code

//package com.java2s;
/*//from www. j av a 2s  .com
* Licensed to OpenCommerceSearch under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. OpenCommerceSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**
     * Date formatter for ISO 8601 dates.
     */
    private static final SimpleDateFormat iso8601Formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

    /**
     * Get valid ISO 8601 date out of a given time in milliseconds.
     * @param millis Time in milliseconds to convert.
     * @return Valid string representation in ISO 8601 format of the given time in milliseconds.
     */
    public static String getISO8601Date(long millis) {
        return iso8601Formatter.format(new Date(millis));
    }
}

Related

  1. get_ISO_8601()
  2. getDateAsISOString(Date date)
  3. getFormattedMillisolString(double s)
  4. getIso8601(final Date date)
  5. getISO8601Date(final Date date)
  6. getIso8601DateFormat()
  7. getIso8601DateFormat()
  8. getIso8601DateFormat()
  9. getISO8601DateFormat()