Java Date Format dateTimeToZuluFormat(DateTime dateTime)

Here you can find the source of dateTimeToZuluFormat(DateTime dateTime)

Description

date Time To Zulu Format

License

Open Source License

Parameter

Parameter Description
dateTime specific dateTime in joda datetime format.

Return

YYYY-MM-DD hh:mm:ss in ZULU (UTC)format

Declaration

public static String dateTimeToZuluFormat(DateTime dateTime) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import org.joda.time.DateTime;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

public class Main {
    /**//from  ww w .  j  a va  2 s . c o  m
     *
     * @param dateTime specific dateTime in joda datetime format.
     * @return YYYY-MM-DD hh:mm:ss in ZULU (UTC)format
     */
    public static String dateTimeToZuluFormat(DateTime dateTime) {
        final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss:SSzzz";
        final SimpleDateFormat sdf = new SimpleDateFormat(ISO_FORMAT);
        final TimeZone utc = TimeZone.getTimeZone("UTC");
        sdf.setTimeZone(utc);
        return sdf.format(dateTime.toDate());
    }
}

Related

  1. dateTimeFormat(Date dateTime)
  2. DateTimeFormat(final Date date)
  3. dateTimeFormatterDate(Date date)
  4. dateTimeToMillis(String dateTime, String format)
  5. dateTimeToStr(Date date, String format)
  6. formatD(Date date)
  7. formatDashedDateDDMMYYYY(Date date)
  8. formatDate(ArrayList list)
  9. formatDate(Date _date)