Here you can find the source of getISO8601Date(long millis)
Parameter | Description |
---|---|
millis | Time in milliseconds to convert. |
public static String getISO8601Date(long millis)
//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)); } }