Java Date Format ISO longToISODate(long longDate)

Here you can find the source of longToISODate(long longDate)

Description

long To ISO Date

License

Open Source License

Declaration

public static String longToISODate(long longDate) 

Method Source Code

//package com.java2s;
/**/*from  w  w w. ja  va2 s .  c om*/
 * Copyright (c) 2010-2016, openHAB.org and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

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

public class Main {
    public static String longToISODate(long longDate) {
        Date date = new Date(longDate);
        return dateToISODate(date);
    }

    public static String dateToISODate(Date date) {
        TimeZone tz = TimeZone.getTimeZone("UTC");
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss.S'Z'");
        dateFormat.setTimeZone(tz);
        return dateFormat.format(date);
    }
}

Related

  1. isoDateFormat(Calendar calendar)
  2. isoDateFormat(final Date date)
  3. isoDateTimeUTC(final Date val)
  4. isoFormat(Date date)
  5. isoTime(Date d)
  6. makeDateISO8601(Date date)
  7. millisecondsToISO8601(long date)
  8. NowFormatISO()
  9. nowISO8601()